From f20d64b4f2926b9a5e30a15c2046249bf068464a Mon Sep 17 00:00:00 2001 From: LukeGus Date: Thu, 15 Oct 2026 21:04:04 -0500 Subject: [PATCH] chore: test that an update keeps a changed auth type (#1601) --- .../tests/hosts/defaults/write-rules.test.ts | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/backend/tests/hosts/defaults/write-rules.test.ts b/src/backend/tests/hosts/defaults/write-rules.test.ts index cb543ec88..321aa8dbf 100644 --- a/src/backend/tests/hosts/defaults/write-rules.test.ts +++ b/src/backend/tests/hosts/defaults/write-rules.test.ts @@ -106,6 +106,31 @@ describe("applyHostDefaultsToWrite", () => { expect(overrides.core).toEqual(["statusCheckEnabled", "username"]); }); + it("keeps a changed auth type on an update without a list", async () => { + userDefault("auth", { authType: "credential", credentialId: 3 }); + const stored = { + id: 5, + userId: "u1", + authType: "credential", + credentialId: 3, + defaultOverrides: JSON.stringify({ core: ["username"] }), + }; + const columns: Record = { + authType: "vault", + credentialId: null, + overrideCredentialUsername: 0, + }; + const overrides = await applyHostDefaultsToWrite({ + ownerId: "u1", + hostId: 5, + columns, + body: { authType: "vault", credentialId: 0 }, + stored: stored as never, + }); + expect(columns.authType).toBe("vault"); + expect(overrides.core).toContain("auth"); + }); + it("keeps a locked key's state for a shared editor", async () => { const overrides = await applyHostDefaultsToWrite({ ownerId: "u1",