1'use strict';
2
3var assert = require('assert');
4var stringify = require('../');
5
6assert(stringify('foo') === '"foo"');
7assert(stringify('foo\u2028bar\u2029baz') === '"foo\\u2028bar\\u2029baz"');
8assert(stringify(new Date('2014-12-19T03:42:00.000Z')) === 'new Date("2014-12-19T03:42:00.000Z")');
9assert(stringify({foo: 'bar'}) === '{"foo":"bar"}');
10assert(stringify(undefined) === 'undefined');
11assert(stringify(null) === 'null');
12assert(
13  stringify({val: "</script><script>alert('bad actor')</script>"}) ===
14  '{"val":"\\u003C\\u002Fscript\\u003E\\u003Cscript\\u003Ealert(\'bad actor\')\\u003C\\u002Fscript\\u003E"}'
15);
16
17console.log('tests passed');
18