You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
671 B
25 lines
671 B
const getPathFromJSON = require('../src/getPathFromJSON')
|
|
const assert = require('assert')
|
|
|
|
describe('getPathFromJSON', function () {
|
|
it('const', function () {
|
|
assert.deepEqual(
|
|
getPathFromJSON('const', { const: { 'foo': 'foo', 'bar': 'bar' } }),
|
|
{ 'foo': 'foo', 'bar': 'bar' }
|
|
)
|
|
})
|
|
|
|
it('const.x', function () {
|
|
assert.deepEqual(
|
|
getPathFromJSON('const.x', { const: { x: { 'foo': 'foo', 'bar': 'bar' } } }),
|
|
{ 'foo': 'foo', 'bar': 'bar' }
|
|
)
|
|
})
|
|
|
|
it('const.y (not exist)', function () {
|
|
assert.deepEqual(
|
|
getPathFromJSON('const.y', { const: { x: { 'foo': 'foo', 'bar': 'bar' } } }),
|
|
undefined
|
|
)
|
|
})
|
|
})
|