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

  1. const getPathFromJSON = require('../src/getPathFromJSON')
  2. const assert = require('assert')
  3. describe('getPathFromJSON', function () {
  4. it('const', function () {
  5. assert.deepEqual(
  6. getPathFromJSON('const', { const: { 'foo': 'foo', 'bar': 'bar' } }),
  7. { 'foo': 'foo', 'bar': 'bar' }
  8. )
  9. })
  10. it('const.x', function () {
  11. assert.deepEqual(
  12. getPathFromJSON('const.x', { const: { x: { 'foo': 'foo', 'bar': 'bar' } } }),
  13. { 'foo': 'foo', 'bar': 'bar' }
  14. )
  15. })
  16. it('const.y (not exist)', function () {
  17. assert.deepEqual(
  18. getPathFromJSON('const.y', { const: { x: { 'foo': 'foo', 'bar': 'bar' } } }),
  19. undefined
  20. )
  21. })
  22. })