Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 28 additions & 7 deletions landing-zone-configurator/app/integration/identity.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,15 @@ import {
type Template,
} from "@lzc/domain";
import pg from "pg";
import { afterAll, beforeAll, describe, expect, it, vi } from "vitest";
import {
afterAll,
beforeAll,
describe,
expect,
it,
onTestFinished,
vi,
} from "vitest";
import { buildApp } from "../apps/api/src/app.js";
import { Applications } from "../apps/api/src/applications/service.js";
import { ApplicationStateRecoveries } from "../apps/api/src/applications/state-recovery.js";
Expand Down Expand Up @@ -2304,6 +2312,10 @@ describe("real PostgreSQL session and tenant boundaries", () => {
};
const draft = editCommonInput(source, "rm_folders", folders);
const stored = await configurations.create(alice, draft);
onTestFinished(async () => {
const current = await configurations.get(alice, stored.id);
await configurations.remove(alice, stored.id, current.revision);
});
const names = Object.fromEntries(
Object.entries(folders).map(([key, folder]) => [
key,
Expand Down Expand Up @@ -2333,13 +2345,13 @@ describe("real PostgreSQL session and tenant boundaries", () => {
changes: [
{ path: "company_name", value: "Example GmbH" },
{ path: "company_code", value: "exg" },
{
path: "rm_folders",
value: { platform: { name: "EXG Platform" } },
},
],
folderNames: {
...names,
platform: { name: "EXG Platform" },
},
references: ["identity-foundations", "governance-folders"],
} satisfies Dialogue);
} satisfies Dialogue & { folderNames: typeof names });
return Response.json({
choices: [
{
Expand Down Expand Up @@ -2377,6 +2389,16 @@ describe("real PostgreSQL session and tenant boundaries", () => {
}
const answerBody = requests[1];
if (!answerBody) throw new Error("Missing naming response request");
const answerRequest = JSON.parse(answerBody);
expect(answerRequest.response_format.json_schema.schema.required).toContain(
"folderNames",
);
expect(
Object.keys(
answerRequest.response_format.json_schema.schema.properties.folderNames
.properties,
).sort(),
).toEqual(Object.keys(names).sort());
const answerContext = JSON.parse(
JSON.parse(answerBody).messages.find(
(entry: { role: string }) => entry.role === "user",
Expand All @@ -2402,7 +2424,6 @@ describe("real PostgreSQL session and tenant boundaries", () => {
"[email protected]",
);
expect(accepted.revision).toBe(2);
await configurations.remove(alice, stored.id, 2);
});

it("discards only the identified pending proposal without changing its configuration, and closes stale continuations", async () => {
Expand Down
Loading