"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const EnhancedJSON = __importStar(require("./enhanced-json"));
describe("EnhancedJSON", () => {
    describe("when parsing an old job with the new thing, old job being an", () => {
        test("an object", () => {
            const oldJob = JSON.stringify({
                userId: 123,
            });
            expect(EnhancedJSON.parse(oldJob)).toEqual({
                userId: 123,
            });
        });
        test("a string", () => {
            const oldJob = JSON.stringify("foo-bar");
            expect(EnhancedJSON.parse(oldJob)).toEqual("foo-bar");
        });
        test("null", () => {
            const oldJob = JSON.stringify(null);
            expect(EnhancedJSON.parse(oldJob)).toEqual(null);
        });
    });
    describe(".stringify", () => {
        it("should not include SuperJSON stuff when not needed", () => {
            const input = { a: "regular object" };
            expect(EnhancedJSON.stringify(input)).toEqual('{"a":"regular object"}');
            expect(EnhancedJSON.parse(EnhancedJSON.stringify(input))).toEqual(input);
            expect(EnhancedJSON.parse(EnhancedJSON.stringify(new Date(10000)))).toEqual(new Date(10000));
        });
    });
    it("should include SuperJSON stuff when needed", () => {
        const input = new Date(10000);
        expect(EnhancedJSON.stringify(input)).toEqual('{"json":"1970-01-01T00:00:10.000Z","_superjson":{"values":["Date"]}}');
        expect(EnhancedJSON.parse(EnhancedJSON.stringify(input))).toEqual(input);
    });
});
//# sourceMappingURL=enhanced-json.spec.js.map