helpers.js 429 B

12345678910111213141516171819202122232425
  1. import test from 'tape';
  2. import { jsonDump } from 'src/injected/utils/helpers';
  3. test('jsonDump', t => {
  4. // eslint-disable-next-line no-restricted-syntax
  5. for (const obj of [
  6. 1,
  7. null,
  8. false,
  9. 'abc',
  10. {},
  11. [],
  12. [1, 2, 3],
  13. {
  14. a: 1, b: '2', c: true, d: 'aaa',
  15. },
  16. {
  17. a: [1, 2, 3],
  18. b: { a: 'b' },
  19. },
  20. ]) {
  21. t.equal(jsonDump(obj), JSON.stringify(obj));
  22. }
  23. t.end();
  24. });