]> git.r.bdr.sh - rbdr/dotfiles/blame_incremental - atom/packages/pretty-json/node_modules/json-stable-stringify/test/to-json.js
Remove easymotion plugin
[rbdr/dotfiles] / atom / packages / pretty-json / node_modules / json-stable-stringify / test / to-json.js
... / ...
CommitLineData
1var test = require('tape');
2var stringify = require('../');
3
4test('toJSON function', function (t) {
5 t.plan(1);
6 var obj = { one: 1, two: 2, toJSON: function() { return { one: 1 }; } };
7 t.equal(stringify(obj), '{"one":1}' );
8});
9
10test('toJSON returns string', function (t) {
11 t.plan(1);
12 var obj = { one: 1, two: 2, toJSON: function() { return 'one'; } };
13 t.equal(stringify(obj), '"one"');
14});
15
16test('toJSON returns array', function (t) {
17 t.plan(1);
18 var obj = { one: 1, two: 2, toJSON: function() { return ['one']; } };
19 t.equal(stringify(obj), '["one"]');
20});