Skip to content

Commit 7b3f05d

Browse files
committed
Remove unnecessary test comparing method to removed lodash.reduce module
Cleans up tests following removal of that library in 347e4ee
1 parent 21bbbef commit 7b3f05d

File tree

2 files changed

+19
-34
lines changed

2 files changed

+19
-34
lines changed

lib/util/object-reduce.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* minification and ~12kb of savings with minification.
99
*
1010
* Unlike lodash.reduce(), the iterator and initial value properties are NOT
11-
* optional: this is done to simplify the code, this module is not intended to
11+
* optional: this is done to simplify the code. This module is not intended to
1212
* be a full replacement for lodash.reduce and instead prioritizes simplicity
1313
* for a specific common case.
1414
*

tests/unit/lib/util/object-reduce.js

Lines changed: 18 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,28 @@
11
'use strict';
22

3-
describe( 'Object reduction tools:', () => {
4-
// Ensure parity with the relevant signature & functionality of lodash.reduce
5-
[
6-
{
7-
name: 'lodash.reduce (for API parity verification)',
8-
fn: require( 'lodash.reduce' ),
9-
}, {
10-
name: 'objectReduce utility',
11-
fn: require( '../../../../lib/util/object-reduce' ),
12-
},
13-
].forEach( ( test ) => {
3+
const objectReduce = require( '../../../../lib/util/object-reduce' );
144

15-
describe( test.name, () => {
16-
const objectReduce = test.fn;
5+
describe( 'objectReduce utility', () => {
176

18-
it( 'is defined', () => {
19-
expect( objectReduce ).toBeDefined();
20-
} );
21-
22-
it( 'is a function', () => {
23-
expect( typeof objectReduce ).toBe( 'function' );
24-
} );
25-
26-
it( 'resolves to the provided initial value if called on an empty object', () => {
27-
expect( objectReduce( {}, () => {}, 'Sasquatch' ) ).toBe( 'Sasquatch' );
28-
} );
7+
it( 'is defined', () => {
8+
expect( objectReduce ).toBeDefined();
9+
} );
2910

30-
it( 'can be used to reduce over an object', () => {
31-
const result = objectReduce( {
32-
key1: 'val1',
33-
key2: 'val2',
34-
key3: 'val3',
35-
}, ( memo, val, key ) => memo + val + key, 'result:' );
36-
expect( result ).toBe( 'result:val1key1val2key2val3key3' );
37-
} );
11+
it( 'is a function', () => {
12+
expect( typeof objectReduce ).toBe( 'function' );
13+
} );
3814

39-
} );
15+
it( 'resolves to the provided initial value if called on an empty object', () => {
16+
expect( objectReduce( {}, () => {}, 'Sasquatch' ) ).toBe( 'Sasquatch' );
17+
} );
4018

19+
it( 'can be used to reduce over an object', () => {
20+
const result = objectReduce( {
21+
key1: 'val1',
22+
key2: 'val2',
23+
key3: 'val3',
24+
}, ( memo, val, key ) => memo + val + key, 'result:' );
25+
expect( result ).toBe( 'result:val1key1val2key2val3key3' );
4126
} );
4227

4328
} );

0 commit comments

Comments
 (0)