Sha256: ebfe070bd31b66bf556526c90640e1880a9cd12549946f2dc140917daa84c222

Contents?: true

Size: 574 Bytes

Versions: 150

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

150 entries across 107 versions & 10 rubygems

Version Path
immosquare-cleaner-0.1.62 node_modules/json-stable-stringify-without-jsonify/test/to-json.js
immosquare-cleaner-0.1.61 node_modules/json-stable-stringify-without-jsonify/test/to-json.js
immosquare-cleaner-0.1.60 node_modules/json-stable-stringify-without-jsonify/test/to-json.js
immosquare-cleaner-0.1.59 node_modules/json-stable-stringify-without-jsonify/test/to-json.js
immosquare-cleaner-0.1.58 node_modules/json-stable-stringify-without-jsonify/test/to-json.js
immosquare-cleaner-0.1.57 node_modules/json-stable-stringify-without-jsonify/test/to-json.js
immosquare-cleaner-0.1.56 node_modules/json-stable-stringify-without-jsonify/test/to-json.js
immosquare-cleaner-0.1.55 node_modules/json-stable-stringify-without-jsonify/test/to-json.js
immosquare-cleaner-0.1.54 node_modules/json-stable-stringify-without-jsonify/test/to-json.js
immosquare-cleaner-0.1.53 node_modules/json-stable-stringify-without-jsonify/test/to-json.js
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