Skip to content

Commit b1cc013

Browse files
test: unit tests for keysAsFunctions
1 parent 35162b7 commit b1cc013

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

lib/utils/tests/keysAsFunctions.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ it('merges objects correctly', async () => {
1313
doubleUse: val => `${val}-doubleUse`
1414
}
1515

16-
const result = await keysAsFunctions(plugins, map)
16+
const result = await keysAsFunctions(plugins, map, [])
1717

1818
expect(result).toEqual([
1919
'foo-simple',

lib/utils/tests/keysAsFunctionsRecursive.spec.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const getBaseObj = () => ({
77
number: 123,
88
obj: { foo: 'bar' },
99
target$map: { fn },
10-
target: {
10+
target$options: {
1111
fn: { isTarget: true, touched: false }
1212
}
1313
}
@@ -32,10 +32,11 @@ it('converts objects to arrays', async () => {
3232
})
3333
})
3434

35+
// target$options will not exist if child is parsed last.
3536
it('processes children first', async () => {
3637
const config = getBaseObj()
37-
config.aPlugin.target.fn.child = { fn: { isTarget: true, touched: false } }
38-
config.aPlugin.target.fn.child$map = { fn }
38+
config.aPlugin.target$options.fn.child$options = { fn: { isTarget: true, touched: false } }
39+
config.aPlugin.target$options.fn.child$map = { fn }
3940

4041

4142
const result = await keysAsFunctionsRecursive(config)

0 commit comments

Comments
 (0)