Validation_Suite/validation-suite/frontend/atlas/tests/quickstart-navigation.test.mjs

27 lines
1.2 KiB
JavaScript

import assert from "node:assert/strict";
import fs from "node:fs";
import test from "node:test";
import path from "node:path";
const sourcePath = path.resolve("components/app-shell.tsx");
const source = fs.readFileSync(sourcePath, "utf8");
test("quickstart action is present in desktop and mobile navigation", () => {
assert.match(source, /const QUICKSTART_HREF = "\/validations\/quick-start"/);
assert.match(source, /Neue Validierung starten/);
assert.match(source, /lg:hidden/);
assert.match(source, /lg:block/);
assert.match(source, /ClipboardPlus/);
});
test("quickstart action is restricted to roles that may start validations", () => {
assert.match(source, /const quickstartRoles = \["admin", "pruefer", "mitarbeiter"\]/);
assert.match(source, /canStartValidation\(auth\.user\?\.role\)/);
});
test("quickstart route has its own active state and does not activate validations item", () => {
assert.match(source, /pathname === QUICKSTART_HREF/);
assert.match(source, /pathname !== QUICKSTART_HREF/);
assert.match(source, /aria-current=\{quickstartActive \? "page" : undefined\}/);
assert.match(source, /aria-current=\{active \? "page" : undefined\}/);
});