Skip to content

Commit

Permalink
test: unit tests for keysAsFunctions
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobrosenberg committed Oct 24, 2020
1 parent 35162b7 commit b1cc013
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/utils/tests/keysAsFunctions.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ it('merges objects correctly', async () => {
doubleUse: val => `${val}-doubleUse`
}

const result = await keysAsFunctions(plugins, map)
const result = await keysAsFunctions(plugins, map, [])

expect(result).toEqual([
'foo-simple',
Expand Down
7 changes: 4 additions & 3 deletions lib/utils/tests/keysAsFunctionsRecursive.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const getBaseObj = () => ({
number: 123,
obj: { foo: 'bar' },
target$map: { fn },
target: {
target$options: {
fn: { isTarget: true, touched: false }
}
}
Expand All @@ -32,10 +32,11 @@ it('converts objects to arrays', async () => {
})
})

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


const result = await keysAsFunctionsRecursive(config)
Expand Down

0 comments on commit b1cc013

Please sign in to comment.