diff --git a/src/domain/jsonShape.test.ts b/src/domain/jsonShape.test.ts index 96db5f81334..8adbc83ddd7 100644 --- a/src/domain/jsonShape.test.ts +++ b/src/domain/jsonShape.test.ts @@ -112,6 +112,14 @@ describe("inferJsonShape", () => { describe("JSON shape completeness and ordering", () => { it("preserves raw property names and code-point ordering independently of key insertion order", () => { + const nestedProperty = ( + name: string, + types: ReturnType["properties"][number]["types"], + ) => ({ + path: [property("nested"), element, property(name)], + types, + observations: 2, + }); for (const reverse of [false, true]) { const object = (number: number, value: unknown) => { const entries = [ @@ -146,56 +154,20 @@ describe("JSON shape completeness and ordering", () => { types: ["object"], observations: 2, }, - { - path: [property("nested"), element, property("A")], - types: ["boolean"], - observations: 2, - }, - { - path: [property("nested"), element, property("_")], - types: ["boolean"], - observations: 2, - }, - { - path: [property("nested"), element, property("a")], - types: ["boolean"], - observations: 2, - }, - { - path: [property("nested"), element, property("e\u0301/~")], - types: ["array", "null"], - observations: 2, - }, + nestedProperty("A", ["boolean"]), + nestedProperty("_", ["boolean"]), + nestedProperty("a", ["boolean"]), + nestedProperty("e\u0301/~", ["array", "null"]), { path: [property("nested"), element, property("e\u0301/~"), element], types: ["null"], observations: 1, }, - { - path: [property("nested"), element, property("e\u0341/~")], - types: ["boolean"], - observations: 2, - }, - { - path: [property("nested"), element, property("z")], - types: ["boolean"], - observations: 2, - }, - { - path: [property("nested"), element, property("é/~")], - types: ["number"], - observations: 2, - }, - { - path: [property("nested"), element, property("\uE000")], - types: ["boolean"], - observations: 2, - }, - { - path: [property("nested"), element, property("\u{10000}")], - types: ["boolean"], - observations: 2, - }, + nestedProperty("e\u0341/~", ["boolean"]), + nestedProperty("z", ["boolean"]), + nestedProperty("é/~", ["number"]), + nestedProperty("\uE000", ["boolean"]), + nestedProperty("\u{10000}", ["boolean"]), ], }); }