From 5e83c1ef7c634b71a400a43611ad267f2cca15eb Mon Sep 17 00:00:00 2001 From: morluto <76467478+morluto@users.noreply.github.com> Date: Wed, 18 Nov 2026 11:30:20 +0800 Subject: [PATCH] test(environment): consolidate document write refusals (#11958) --- .../environmentStateWriteRefusals.test.ts | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/application/environment/environmentStateWriteRefusals.test.ts b/src/application/environment/environmentStateWriteRefusals.test.ts index da4ad02e07..01b34eab81 100644 --- a/src/application/environment/environmentStateWriteRefusals.test.ts +++ b/src/application/environment/environmentStateWriteRefusals.test.ts @@ -58,13 +58,18 @@ const nested = (depth: number): JsonValue => Array.from({ length: depth }).reduce((inner) => [inner], 1); describe("served document writes", () => { - it("accepts only the members the capture sent, as the JSON types the document holds", () => { + it("changes only the recorded document path with the learned member names and types", () => { const settings = servedFrom(SETTINGS_ROWS); expect(settings.state.writes.get(PATCH_SETTINGS)).toMatchObject({ served: true, effect: "document", }); expectRefusedUnchanged(settings, [ + [ + PATCH_SETTINGS, + { id: "2", body: { theme: "blue" } }, + "holds this document only at /api/orgs/1/settings", + ], [ PATCH_SETTINGS, { id: "1", body: { theme: 5, extra: true } }, @@ -76,6 +81,7 @@ describe("served document writes", () => { "Member extra is not one the capture showed stored", ], ]); + expect(settings.answer(READ_SETTINGS, { id: "1" }).body).toEqual(DARK); const blue = { theme: "blue", meta: DARK.meta }; expect( settings.answer(PATCH_SETTINGS, { id: "1", body: { theme: "blue" } }), @@ -109,18 +115,6 @@ describe("served document writes", () => { served: false, }); }); - - it("changes the document only at the path the state holds it", () => { - const settings = servedFrom(SETTINGS_ROWS); - expectRefusedUnchanged(settings, [ - [ - PATCH_SETTINGS, - { id: "2", body: { theme: "blue" } }, - "holds this document only at /api/orgs/1/settings", - ], - ]); - expect(settings.answer(READ_SETTINGS, { id: "1" }).body).toEqual(DARK); - }); }); describe("values the state can load back", () => {