Spaces:
Running
Running
Delete console/src/workspaces/workspaceRoutes.test.mjs
Browse files
console/src/workspaces/workspaceRoutes.test.mjs
DELETED
|
@@ -1,50 +0,0 @@
|
|
| 1 |
-
import assert from "node:assert/strict";
|
| 2 |
-
import test from "node:test";
|
| 3 |
-
import {
|
| 4 |
-
accessibleWorkspaceTabs,
|
| 5 |
-
resolveRoutedWorkspace,
|
| 6 |
-
scopedRequestBrainId,
|
| 7 |
-
switchWorkspacePath,
|
| 8 |
-
workspaceCacheKey,
|
| 9 |
-
workspacePath,
|
| 10 |
-
} from "./workspaceRoutes.ts";
|
| 11 |
-
|
| 12 |
-
const alpha = { slug: "alpha", brain_id: "alpha", archived: false };
|
| 13 |
-
const beta = { slug: "beta", brain_id: "beta", archived: false };
|
| 14 |
-
|
| 15 |
-
test("route resolves the exact workspace", () => {
|
| 16 |
-
assert.equal(resolveRoutedWorkspace([alpha, beta], "beta"), beta);
|
| 17 |
-
});
|
| 18 |
-
|
| 19 |
-
test("workspace switch preserves the active subpage", () => {
|
| 20 |
-
assert.equal(switchWorkspacePath("/w/alpha/graph", "beta"), "/w/beta/graph");
|
| 21 |
-
});
|
| 22 |
-
|
| 23 |
-
test("workspace switching is represented as navigation data, not reload", () => {
|
| 24 |
-
assert.equal(switchWorkspacePath("/w/alpha/tasks", "beta"), "/w/beta/tasks");
|
| 25 |
-
assert.equal(switchWorkspacePath.toString().includes("location.reload"), false);
|
| 26 |
-
});
|
| 27 |
-
|
| 28 |
-
test("system PAT sees multiple workspaces", () => {
|
| 29 |
-
assert.deepEqual(accessibleWorkspaceTabs([alpha, beta], true), [alpha, beta]);
|
| 30 |
-
});
|
| 31 |
-
|
| 32 |
-
test("per-brain PAT remains locked to its brain", () => {
|
| 33 |
-
assert.deepEqual(accessibleWorkspaceTabs([alpha, beta], false, "alpha"), [alpha]);
|
| 34 |
-
});
|
| 35 |
-
|
| 36 |
-
test("unknown route does not fall back to another workspace", () => {
|
| 37 |
-
assert.equal(resolveRoutedWorkspace([alpha, beta], "missing"), null);
|
| 38 |
-
});
|
| 39 |
-
|
| 40 |
-
test("created workspace has a canonical overview navigation target", () => {
|
| 41 |
-
assert.equal(workspacePath("new-space"), "/w/new-space/");
|
| 42 |
-
});
|
| 43 |
-
|
| 44 |
-
test("API request scope comes from the active workspace brain", () => {
|
| 45 |
-
assert.equal(scopedRequestBrainId(beta), "beta");
|
| 46 |
-
});
|
| 47 |
-
|
| 48 |
-
test("workspace cache keys differ across brains", () => {
|
| 49 |
-
assert.notEqual(workspaceCacheKey("graph", "alpha"), workspaceCacheKey("graph", "beta"));
|
| 50 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|