Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 6296889

Browse files
Upgrade jest and remove jest-each
1 parent 45549c8 commit 6296889

File tree

8 files changed

+1556
-652
lines changed

8 files changed

+1556
-652
lines changed

‎package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@
3030
"babel-preset-es2015": "^6.18.0",
3131
"babel-preset-stage-0": "^6.16.0",
3232
"coveralls": "^3.0.0",
33-
"jest": "^22.0.0",
34-
"jest-each": "0.3.1"
33+
"jest": "^23.6.0"
3534
},
3635
"babel": {
3736
"presets": [

‎src/added/index.test.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
import forEach from 'jest-each';
2-
31
import addedDiff from './';
42

53
describe('.addedDiff', () => {
64

75
describe('base case', () => {
86
describe('equal', () => {
9-
forEach([
7+
test.each([
108
['int', 1],
119
['string', 'a'],
1210
['boolean', true],
@@ -16,13 +14,13 @@ describe('.addedDiff', () => {
1614
['array', [1]],
1715
['function', () => ({})],
1816
['date', new Date()],
19-
]).test('returns empty object when given values of type %s are equal', (type, value) => {
17+
])('returns empty object when given values of type %s are equal', (type, value) => {
2018
expect(addedDiff(value, value)).toEqual({});
2119
});
2220
});
2321

2422
describe('not equal and not object', () => {
25-
forEach([
23+
test.each([
2624
[1, 2],
2725
['a', 'b'],
2826
[true, false],
@@ -35,7 +33,7 @@ describe('.addedDiff', () => {
3533
[100, () => ({})],
3634
[() => ({}), 100],
3735
[new Date('2017年01月01日'), new Date('2017年01月02日')],
38-
]).test('returns empty object when values are not equal (%s, %s)', (lhs, rhs) => {
36+
])('returns empty object when values are not equal (%s, %s)', (lhs, rhs) => {
3937
expect(addedDiff(lhs, rhs)).toEqual({});
4038
});
4139
});

‎src/arrayDiff/index.test.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
import forEach from 'jest-each';
2-
31
import diff from './';
42

53
describe('.arrayDiff', () => {
64

75
describe('base case', () => {
86
describe('equal', () => {
9-
forEach([
7+
test.each([
108
['int', 1],
119
['string', 'a'],
1210
['boolean', true],
@@ -17,13 +15,13 @@ describe('.arrayDiff', () => {
1715
['function', () => ({})],
1816
['date', new Date()],
1917
['date with milliseconds', new Date('2017年01月01日T00:00:00.637Z')],
20-
]).test('returns empty object when given values of type %s are equal', (type, value) => {
18+
])('returns empty object when given values of type %s are equal', (type, value) => {
2119
expect(diff(value, value)).toEqual({});
2220
});
2321
});
2422

2523
describe('not equal and not object', () => {
26-
forEach([
24+
test.each([
2725
[1, 2],
2826
['a', 'b'],
2927
[true, false],
@@ -37,7 +35,7 @@ describe('.arrayDiff', () => {
3735
[() => ({}), 100],
3836
[new Date('2017年01月01日'), new Date('2017年01月02日')],
3937
[new Date('2017年01月01日T00:00:00.636Z'), new Date('2017年01月01日T00:00:00.637Z')],
40-
]).test('returns right hand side value when different to left hand side value (%s, %s)', (lhs, rhs) => {
38+
])('returns right hand side value when different to left hand side value (%s, %s)', (lhs, rhs) => {
4139
expect(diff(lhs, rhs)).toEqual(rhs);
4240
});
4341
});
@@ -100,7 +98,6 @@ describe('.arrayDiff', () => {
10098
delete expected['0'];
10199
delete expected['1'];
102100
delete expected['2'];
103-
// expected.forEach(console.log)
104101
expect(diff([1, 2, 3], [1, 2, 3, 9])).toEqual(expected);
105102
});
106103
});

‎src/deleted/index.test.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
import forEach from 'jest-each';
2-
31
import deletedDiff from './';
42

53
describe('.deletedDiff', () => {
64

75
describe('base case', () => {
86
describe('equal', () => {
9-
forEach([
7+
test.each([
108
['int', 1],
119
['string', 'a'],
1210
['boolean', true],
@@ -16,13 +14,13 @@ describe('.deletedDiff', () => {
1614
['array', [1]],
1715
['function', () => ({})],
1816
['date', new Date()],
19-
]).test('returns empty object when given values of type %s are equal', (type, value) => {
17+
])('returns empty object when given values of type %s are equal', (type, value) => {
2018
expect(deletedDiff(value, value)).toEqual({});
2119
});
2220
});
2321

2422
describe('not equal and not object', () => {
25-
forEach([
23+
test.each([
2624
[1, 2],
2725
['a', 'b'],
2826
[true, false],
@@ -35,7 +33,7 @@ describe('.deletedDiff', () => {
3533
[100, () => ({})],
3634
[() => ({}), 100],
3735
[new Date('2017年01月01日'), new Date('2017年01月02日')],
38-
]).test('returns empty object when given values are unequal', (lhs, rhs) => {
36+
])('returns empty object when given values: %s %s are unequal', (lhs, rhs) => {
3937
expect(deletedDiff(lhs, rhs)).toEqual({});
4038
});
4139
});

‎src/diff/index.test.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
import forEach from 'jest-each';
2-
31
import diff from './';
42

53
describe('.diff', () => {
64

75
describe('base case', () => {
86
describe('equal', () => {
9-
forEach([
7+
test.each([
108
['int', 1],
119
['string', 'a'],
1210
['boolean', true],
@@ -17,13 +15,13 @@ describe('.diff', () => {
1715
['function', () => ({})],
1816
['date', new Date()],
1917
['date with milliseconds', new Date('2017年01月01日T00:00:00.637Z')],
20-
]).test('returns empty object when given values of type %s are equal', (type, value) => {
18+
])('returns empty object when given values of type %s are equal', (type, value) => {
2119
expect(diff(value, value)).toEqual({});
2220
});
2321
});
2422

2523
describe('not equal and not object', () => {
26-
forEach([
24+
test.each([
2725
[1, 2],
2826
['a', 'b'],
2927
[true, false],
@@ -37,7 +35,7 @@ describe('.diff', () => {
3735
[() => ({}), 100],
3836
[new Date('2017年01月01日'), new Date('2017年01月02日')],
3937
[new Date('2017年01月01日T00:00:00.636Z'), new Date('2017年01月01日T00:00:00.637Z')],
40-
]).test('returns right hand side value when different to left hand side value (%s, %s)', (lhs, rhs) => {
38+
])('returns right hand side value when different to left hand side value (%s, %s)', (lhs, rhs) => {
4139
expect(diff(lhs, rhs)).toEqual(rhs);
4240
});
4341
});

‎src/updated/index.test.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
import forEach from 'jest-each';
2-
31
import updatedDiff from './';
42

53
describe('.updatedDiff', () => {
64

75
describe('base case', () => {
86
describe('equal', () => {
9-
forEach([
7+
test.each([
108
['int', 1],
119
['string', 'a'],
1210
['boolean', true],
@@ -17,13 +15,13 @@ describe('.updatedDiff', () => {
1715
['function', () => ({})],
1816
['date', new Date()],
1917
['date with milliseconds', new Date('2017年01月01日T00:00:00.637Z')],
20-
]).test('returns empty object when given values of type %s are equal', (type, value) => {
18+
])('returns empty object when given values of type %s are equal', (type, value) => {
2119
expect(updatedDiff(value, value)).toEqual({});
2220
});
2321
});
2422

2523
describe('not equal and not object', () => {
26-
forEach([
24+
test.each([
2725
[1, 2],
2826
['a', 'b'],
2927
[true, false],
@@ -37,7 +35,7 @@ describe('.updatedDiff', () => {
3735
[() => ({}), 100],
3836
[new Date('2017年01月01日'), new Date('2017年01月02日')],
3937
[new Date('2017年01月01日T00:00:00.636Z'), new Date('2017年01月01日T00:00:00.637Z')],
40-
]).test('returns right hand side value when different to left hand side value (%s, %s)', (lhs, rhs) => {
38+
])('returns right hand side value when different to left hand side value (%s, %s)', (lhs, rhs) => {
4139
expect(updatedDiff(lhs, rhs)).toEqual(rhs);
4240
});
4341
});

‎src/utils/index.test.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,29 @@
1-
import forEach from 'jest-each';
2-
31
import { isDate, isEmpty, isObject, properObject } from './';
42

53
describe('utils', () => {
64

75
describe('.isDate', () => {
8-
forEach([
6+
test.each([
97
[new Date()],
108
[new Date('2016')],
119
[new Date('2016-01')],
1210
[new Date('2016年01月01日')],
1311
[new Date('2016年01月01日:14:45:20')],
1412
[new Date('Tue Feb 14 2017 14:45:20 GMT+0000 (GMT)')],
1513
[new Date('nonsense')],
16-
]).test('returns true when given a date object of %s', (date) => {
14+
])('returns true when given a date object of %s', (date) => {
1715
expect(isDate(date)).toBe(true);
1816
});
1917

20-
forEach([
18+
test.each([
2119
[100],
2220
['100'],
2321
[false],
2422
[{ a: 100 }],
2523
[[100, 101, 102]],
2624
[Date.parse('2016')],
2725
[Date.now()],
28-
]).test('returns false when not given a date object of %s', (x) => {
26+
])('returns false when not given a date object of %s', (x) => {
2927
expect(isDate(x)).toBe(false);
3028
});
3129
});
@@ -61,14 +59,14 @@ describe('utils', () => {
6159
expect(isObject([])).toBe(true);
6260
});
6361

64-
forEach([
62+
test.each([
6563
['int', 1],
6664
['string', 'a'],
6765
['boolean', true],
6866
['null', null],
6967
['undefined', undefined],
7068
['function', () => ({})],
71-
]).test('returns false when value is of type: %s', (type, value) => {
69+
])('returns false when value is of type: %s', (type, value) => {
7270
expect(isObject(value)).toBe(false);
7371
});
7472
});

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /