UNPKG

@bizone-ai/json-transform-utils

Version:

Utilities for handling JSON transformers

22 lines 957 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const vitest_1 = require("vitest"); const parse_1 = require("../parse"); (0, vitest_1.describe)("parse", () => { (0, vitest_1.test)("should parse $name", () => { const prevPaths = ["$name", "$name.a"]; const paths = ["target"]; const typeMap = { $name: { type: "object" }, "$name.a": { type: "string" }, }; (0, parse_1.parseTransformer)("$name", "target", prevPaths, paths, typeMap); // check that target paths were added (0, vitest_1.expect)(paths).toEqual(["target", "target.a"]); // check that types were added (0, vitest_1.expect)(Object.keys(typeMap)).toHaveLength(4); (0, vitest_1.expect)(typeMap["target"]).toEqual({ type: "object" }); (0, vitest_1.expect)(typeMap["target.a"]).toEqual({ type: "string" }); }); }); //# sourceMappingURL=parse.test.js.map