main-test.js 660 B

12345678910111213141516171819202122232425262728293031
  1. var run = require('./run');
  2. var path = require('path');
  3. /* jshint quotmark:false */
  4. var file1 = path.join(__dirname, 'assets', 'data.json');
  5. var expected1 = [
  6. { "hello": "world" },
  7. { "0": "a", "1": "b", "2": "c" },
  8. { "list": ["mr", "plow"] },
  9. { "foo": [
  10. "bar",
  11. "baz",
  12. 2,
  13. { "one": "two" },
  14. ["a", "b", "c"],
  15. ],
  16. "yes": "no"
  17. }
  18. ];
  19. var file2 = path.join(__dirname, 'assets', 'array.json');
  20. var expected2 = [
  21. { "id": "one" },
  22. { "id": "two" },
  23. { "id": "three" },
  24. { "id": "four" }
  25. ];
  26. run('Read a file with JSON strings', file1, expected1);
  27. run('Read a file with JSON objects in an array', file2, expected2);