"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const assert = require("assert");
const evaluate_1 = require("../../spec/evaluate");
const fromId_1 = require("../../spec/fromId");
const stringify_1 = require("../../spec/stringify");
const _classes_1 = require("../../system/_classes");
const _specs_1 = require("../../system/_specs");
// stringify
assert.deepEqual((0, stringify_1.stringify)(1), '1');
assert.deepEqual((0, stringify_1.stringify)(Infinity), 'Infinity');
// assert.deepEqual(stringify('\n'), `"\\n"`)
// assert.deepEqual(stringify('"\n"'), `"\\"\\n\\""`)
assert.deepEqual((0, stringify_1.stringify)("'\n'"), `"'\n'"`);
assert.deepEqual((0, stringify_1.stringify)('foo'), `"foo"`);
assert.deepEqual((0, stringify_1.stringify)('"foo"'), `"\\"foo\\""`);
assert.deepEqual((0, stringify_1.stringify)("'foo'"), `"'foo'"`);
assert.deepEqual((0, stringify_1.stringify)("''foo''"), `"''foo''"`);
assert.deepEqual((0, stringify_1.stringify)('\\'), `"\\\\"`);
assert.deepEqual((0, stringify_1.stringify)("'\\'"), `"'\\\\'"`);
assert.deepEqual((0, stringify_1.stringify)(true), 'true');
assert.deepEqual((0, stringify_1.stringify)(false), 'false');
assert.deepEqual((0, stringify_1.stringify)([]), '[]');
assert.deepEqual((0, stringify_1.stringify)([1, 2, 3]), '[1,2,3]');
assert.deepEqual((0, stringify_1.stringify)({ 'input/a': 'foo' }), `{"input/a":"foo"}`);
assert.deepEqual((0, stringify_1.stringify)({ method: 'PUT', headers: { 'Content-Type': 'application/json' } }), `{"method":"PUT","headers":{"Content-Type":"application/json"}}`);
assert.deepEqual((0, stringify_1.stringify)([
    [1, 0],
    [0, 0],
]), '[[1,0],[0,0]]');
// prettier-ignore
assert.deepEqual((0, stringify_1.stringify)('{"error":{"errors":[{"domain": "global","reason": "required","message": "Login Required","locationType": "header","location": "Authorization"}],"code": 401,"message": "Login Required"}}")'), `"{\\"error\\":{\\"errors\\":[{\\"domain\\": \\"global\\",\\"reason\\": \\"required\\",\\"message\\": \\"Login Required\\",\\"locationType\\": \\"header\\",\\"location\\": \\"Authorization\\"}],\\"code\\": 401,\\"message\\": \\"Login Required\\"}}\\")"`);
// prettier-ignore
assert.deepEqual((0, stringify_1.stringify)(`{
    "error": {
     "errors": [
      {
       "domain": "global",
       "reason": "required",
       "message": "Login Required",
       "locationType": "header",
       "location": "Authorization"
      }
     ],
     "code": 401,
     "message": "Login Required"
    }
   }
   `), `"{\n    \\"error\\": {\n     \\"errors\\": [\n      {\n       \\"domain\\": \\"global\\",\n       \\"reason\\": \\"required\\",\n       \\"message\\": \\"Login Required\\",\n       \\"locationType\\": \\"header\\",\n       \\"location\\": \\"Authorization\\"\n      }\n     ],\n     \\"code\\": 401,\n     \\"message\\": \\"Login Required\\"\n    }\n   }\n   "`);
assert.deepEqual((0, stringify_1.stringify)({ foo: 0 }), '{"foo":0}');
assert.deepEqual((0, stringify_1.stringify)('\\'), '"\\\\"');
assert.deepEqual((0, stringify_1.stringify)(['\\']), '["\\\\"]');
assert.deepEqual((0, stringify_1.stringify)({ foo: 'bar', zaz: 'tar' }), `{"foo":"bar","zaz":"tar"}`);
assert.deepEqual((0, stringify_1.stringify)({ 1: 1 }), '{"1":1}');
assert.deepEqual((0, stringify_1.stringify)((0, fromId_1.bundleFromId)('6fe452f2-2ec1-4ee2-887d-751c3697e6bf', _specs_1.default, _classes_1.default, {})), `\${"unit":{"id":"6fe452f2-2ec1-4ee2-887d-751c3697e6bf"},"specs":{}}`);
assert.deepEqual((0, stringify_1.stringify)((0, fromId_1.bundleFromId)('fa94b179-00e3-4ed1-814e-7938324a833f', _specs_1.default, _classes_1.default)), `\${"unit":{"id":"fa94b179-00e3-4ed1-814e-7938324a833f"},"specs":{}}`);
assert.deepEqual((0, evaluate_1.evaluate)((0, stringify_1.stringify)('"\\n"'), _specs_1.default, _classes_1.default), '"\\\\n"');
assert.deepEqual(JSON.parse((0, evaluate_1.evaluate)((0, stringify_1.stringify)('"\\n"'), _specs_1.default, _classes_1.default)), '\\n');
assert.deepEqual(JSON.parse((0, evaluate_1.evaluate)((0, stringify_1.stringify)(JSON.stringify('\r')), _specs_1.default, _classes_1.default)), '\\r');
//# sourceMappingURL=stringify.js.map