2.9.0 • Published 6 years ago
jest-plugin-its v2.9.0
jest-plugin-its
Adds subject
and its
implementations from RSpec to Jest.
Getting Started
Install jest-plugin-its
using yarn
:
yarn add --dev jest-plugin-its
Motivation
Usage
If you want, you can import its
and subject
for each test file via:
import {its, subject} from 'jest-plugin-its';
If you want to install its
and subject
as globals, you can modify the jest
section of your package.json
to include:
"jest": {
"setupFiles": [
"jest-plugin-its/setup"
]
},
Example
Here's an example that tests the implementation of its
:
import {its, subject} from '../';
describe('its', () => {
describe('with primitives', () => {
subject(() => ({a: 1, b: 2}));
its('a', () => isExpected.toEqual(1));
its('b', () => isExpected.toEqual(2));
});
describe('with functions', () => {
subject(() => ({a: () => 1, b: () => 2}));
its('a', () => isExpected.toEqual(1));
its('b', () => isExpected.toEqual(2));
});
describe('with nested properties', () => {
subject(() => ({a: {b: {c: 1, d: 2}}}));
its('a.b.c', () => isExpected.toEqual(1));
its('a.b.d', () => isExpected.toEqual(2));
});
});
2.9.0
6 years ago
2.8.2
6 years ago
2.8.1
6 years ago
2.8.0
6 years ago
2.7.0
6 years ago
2.6.0
6 years ago
2.5.1
6 years ago
2.5.0
7 years ago
2.4.2
7 years ago
2.4.1
7 years ago
2.4.0
7 years ago
2.3.4
7 years ago
2.3.3
7 years ago
2.3.2
7 years ago
2.3.1
7 years ago
2.3.0
7 years ago
2.2.4
7 years ago
2.2.3
7 years ago
2.2.2
7 years ago
2.2.1
7 years ago
2.2.0
7 years ago
2.0.1
7 years ago
2.0.0
7 years ago
1.8.3
7 years ago
1.8.0
7 years ago
1.7.1
7 years ago
1.7.0
7 years ago
1.5.0
7 years ago
1.4.0
7 years ago
1.3.2
7 years ago
1.3.0
7 years ago
1.2.0
7 years ago
1.0.0
7 years ago
0.3.0
7 years ago
0.2.0
7 years ago
0.1.0
7 years ago
0.0.2
7 years ago