source: imaps-frontend/node_modules/json-stable-stringify-without-jsonify/test/str.js@ d565449

main
Last change on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 758 bytes
RevLine 
[d565449]1var test = require('tape');
2var stringify = require('../');
3
4test('simple object', function (t) {
5 t.plan(1);
6 var obj = { c: 6, b: [4,5], a: 3, z: null };
7 t.equal(stringify(obj), '{"a":3,"b":[4,5],"c":6,"z":null}');
8});
9
10test('object with undefined', function (t) {
11 t.plan(1);
12 var obj = { a: 3, z: undefined };
13 t.equal(stringify(obj), '{"a":3}');
14});
15
16test('array with undefined', function (t) {
17 t.plan(1);
18 var obj = [4, undefined, 6];
19 t.equal(stringify(obj), '[4,null,6]');
20});
21
22test('object with empty string', function (t) {
23 t.plan(1);
24 var obj = { a: 3, z: '' };
25 t.equal(stringify(obj), '{"a":3,"z":""}');
26});
27
28test('array with empty string', function (t) {
29 t.plan(1);
30 var obj = [4, '', 6];
31 t.equal(stringify(obj), '[4,"",6]');
32});
Note: See TracBrowser for help on using the repository browser.