git.schokokeks.org
Repositories
Help
Report an Issue
fs-words.git
Code
Commits
Branches
Tags
Suche
Strukturansicht:
6e9c872
Branches
Tags
develop-client_server
master
typescript
fs-words.git
server
lib
node_modules
fast-json-stable-stringify
test
to-json.js
[add] server:lib:node_modules
Christian Fraß
commited
6e9c872
at 2021-03-08 23:52:07
to-json.js
Blame
History
Raw
'use strict'; 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"]'); });