feat: complete catalog-driven preprocessing
Publish documentation / publish (push) Successful in 2m12s
Publish documentation / publish (push) Successful in 2m12s
This commit is contained in:
@@ -7,6 +7,7 @@ import { AppShell } from "./AppShell";
|
||||
import { clearAuthState, getAuthGeneration, getAuthState, setAuthState, useAuthGeneration, useAuthUser } from "../auth/authState";
|
||||
import { server } from "../test/msw";
|
||||
import { useSessionStore } from "../store/sessionStore";
|
||||
import { workspacePreferences } from "../workspaces/preferences";
|
||||
|
||||
function renderShell(user: {
|
||||
subject: string;
|
||||
@@ -31,6 +32,7 @@ function KeyedAuthenticatedShell() {
|
||||
|
||||
beforeEach(() => {
|
||||
clearAuthState();
|
||||
workspacePreferences.reset();
|
||||
useSessionStore.getState().resetSession();
|
||||
server.use(
|
||||
http.get("/api/sessions", () => HttpResponse.json([])),
|
||||
@@ -45,6 +47,52 @@ beforeEach(() => {
|
||||
});
|
||||
|
||||
describe("authenticated shell permissions", () => {
|
||||
test("does not use the legacy installation default as a preprocessing workspace", async () => {
|
||||
const requestedWorkspaceIds: string[] = [];
|
||||
server.use(
|
||||
http.get("/api/settings", () => HttpResponse.json({
|
||||
workspace: "local", provider: "test", model: "test", thinking: "low",
|
||||
})),
|
||||
http.get("/api/workspaces", () => HttpResponse.json([{
|
||||
id: "psd-clinical",
|
||||
name: "psd-clinical",
|
||||
file: "psd-clinical/workspace.yaml",
|
||||
displayName: "Policlinico San Donato",
|
||||
configurationState: "ready",
|
||||
revision: {
|
||||
id: "psd-clinical",
|
||||
commit: "a".repeat(40),
|
||||
blob: "b".repeat(40),
|
||||
snapshotPath: "/tmp/psd-clinical.yaml",
|
||||
},
|
||||
}])),
|
||||
http.get("/api/workspaces/:workspaceId/preprocessing", ({ params }) => {
|
||||
requestedWorkspaceIds.push(String(params.workspaceId));
|
||||
return HttpResponse.json({
|
||||
schemaVersion: 1,
|
||||
workspaceId: String(params.workspaceId),
|
||||
state: "ready",
|
||||
actionable: true,
|
||||
clearable: true,
|
||||
detail: "Workspace preprocessing is current.",
|
||||
});
|
||||
}),
|
||||
);
|
||||
|
||||
const user = userEvent.setup();
|
||||
renderShell({
|
||||
subject: "admin-1",
|
||||
isAdmin: true,
|
||||
roles: ["admin"],
|
||||
permissions: ["session.use", "database.manage"],
|
||||
});
|
||||
|
||||
const administration = await screen.findByRole("button", { name: "Administration" });
|
||||
await user.click(administration);
|
||||
await waitFor(() => expect(requestedWorkspaceIds).toContain("psd-clinical"));
|
||||
expect(requestedWorkspaceIds).not.toContain("local");
|
||||
});
|
||||
|
||||
test("hides administrative navigation from a session user", async () => {
|
||||
renderShell({ subject: "user-1", isAdmin: false, roles: ["user"], permissions: ["session.use"] });
|
||||
|
||||
@@ -80,10 +128,12 @@ describe("authenticated shell permissions", () => {
|
||||
const separator = within(panel).getByRole("separator");
|
||||
const workspace = within(panel).getByRole("button", { name: "Workspace management" });
|
||||
const pi = within(panel).getByRole("button", { name: "Pi management" });
|
||||
const preprocessing = within(panel).getByRole("region", { name: "Workspace preprocessing" });
|
||||
expect(panel.children[0]).toBe(database);
|
||||
expect(panel.children[1]).toBe(separator);
|
||||
expect(panel.children[2]).toBe(workspace);
|
||||
expect(panel.children[3]).toBe(pi);
|
||||
expect(panel.children[4]).toBe(preprocessing);
|
||||
expect(screen.getByRole("tab", { name: "All sessions" })).toBeInTheDocument();
|
||||
|
||||
await user.keyboard(" ");
|
||||
|
||||
Reference in New Issue
Block a user