Lamassu update script changes (#126)
* lamassu-migrate-config script added + lamassu-default.json * lamassu update script changes * lamassu-update unit test added
This commit is contained in:
parent
63e0782e32
commit
c3535e6ed3
8 changed files with 213 additions and 36 deletions
35
test/unit/migrate-options.js
Normal file
35
test/unit/migrate-options.js
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
import test from 'ava'
|
||||
import _ from 'lodash/fp'
|
||||
|
||||
import {mapKeyValuesDeep} from '../../lib/migrate-options'
|
||||
|
||||
test('mapKeyValuesDeep', t => {
|
||||
const test = {
|
||||
a: {
|
||||
b: 1
|
||||
},
|
||||
c: [
|
||||
{
|
||||
d: 2,
|
||||
e: 3
|
||||
}
|
||||
],
|
||||
f: {
|
||||
g: {
|
||||
h: [
|
||||
{
|
||||
i: 4
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
const expected = [{b: 1}, {d: 2}, {e: 3}, {i: 4}]
|
||||
|
||||
const result = []
|
||||
mapKeyValuesDeep((v, k) => {
|
||||
result.push(_.fromPairs([[k, v]]))
|
||||
}, test)
|
||||
|
||||
t.deepEqual(result, expected)
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue