Sha256: ebfe070bd31b66bf556526c90640e1880a9cd12549946f2dc140917daa84c222

Contents?: true

Size: 574 Bytes

Versions: 140

Compression:

Stored size: 574 Bytes

Contents

var test = require('tape');
var stringify = require('../');

test('toJSON function', function (t) {
    t.plan(1);
    var obj = { one: 1, two: 2, toJSON: function() { return { one: 1 }; } };
    t.equal(stringify(obj), '{"one":1}' );
});

test('toJSON returns string', function (t) {
	t.plan(1);
	var obj = { one: 1, two: 2, toJSON: function() { return 'one'; } };
	t.equal(stringify(obj), '"one"');
});

test('toJSON returns array', function (t) {
	t.plan(1);
	var obj = { one: 1, two: 2, toJSON: function() { return ['one']; } };
	t.equal(stringify(obj), '["one"]');
});

Version data entries

140 entries across 97 versions & 10 rubygems

Version Path
immosquare-cleaner-0.1.52 node_modules/json-stable-stringify-without-jsonify/test/to-json.js
immosquare-cleaner-0.1.51 node_modules/json-stable-stringify-without-jsonify/test/to-json.js
immosquare-cleaner-0.1.50 node_modules/json-stable-stringify-without-jsonify/test/to-json.js
immosquare-cleaner-0.1.49 node_modules/json-stable-stringify-without-jsonify/test/to-json.js
immosquare-cleaner-0.1.48 node_modules/json-stable-stringify-without-jsonify/test/to-json.js
immosquare-cleaner-0.1.47 node_modules/json-stable-stringify-without-jsonify/test/to-json.js
immosquare-cleaner-0.1.46 node_modules/json-stable-stringify-without-jsonify/test/to-json.js
immosquare-cleaner-0.1.45 node_modules/json-stable-stringify-without-jsonify/test/to-json.js
immosquare-cleaner-0.1.44 node_modules/json-stable-stringify-without-jsonify/test/to-json.js
immosquare-cleaner-0.1.43 node_modules/json-stable-stringify-without-jsonify/test/to-json.js
immosquare-cleaner-0.1.42 node_modules/json-stable-stringify-without-jsonify/test/to-json.js
immosquare-cleaner-0.1.41 node_modules/json-stable-stringify-without-jsonify/test/to-json.js
immosquare-cleaner-0.1.40 node_modules/json-stable-stringify-without-jsonify/test/to-json.js
immosquare-cleaner-0.1.39 node_modules/json-stable-stringify-without-jsonify/test/to-json.js
immosquare-cleaner-0.1.38 node_modules/json-stable-stringify-without-jsonify/test/to-json.js
immosquare-cleaner-0.1.32 node_modules/json-stable-stringify-without-jsonify/test/to-json.js
immosquare-cleaner-0.1.31 node_modules/json-stable-stringify-without-jsonify/test/to-json.js
immosquare-cleaner-0.1.30 node_modules/json-stable-stringify-without-jsonify/test/to-json.js
immosquare-cleaner-0.1.29 node_modules/json-stable-stringify-without-jsonify/test/to-json.js
immosquare-cleaner-0.1.28 node_modules/json-stable-stringify-without-jsonify/test/to-json.js