Harden user management integration
This commit is contained in:
parent
73579d1e79
commit
847f4e9493
18 changed files with 394 additions and 111 deletions
26
tests/config-access.test.ts
Normal file
26
tests/config-access.test.ts
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import assert from "node:assert/strict";
|
||||
import { describe, it } from "node:test";
|
||||
import {
|
||||
getConfigEntry,
|
||||
getConfigRedirect,
|
||||
getConfigTabs,
|
||||
} from "../src/frontend/utils/config-access.js";
|
||||
|
||||
describe("config access", () => {
|
||||
it("offers account settings to every signed-in user", () => {
|
||||
assert.deepEqual(getConfigEntry(false), { href: "/config/konto", label: "Konto" });
|
||||
assert.deepEqual(getConfigTabs(false), [{ href: "/config/konto", label: "Konto" }]);
|
||||
assert.equal(getConfigRedirect("/config", false), "/config/konto");
|
||||
assert.equal(getConfigRedirect("/config/konto", false), null);
|
||||
});
|
||||
|
||||
it("keeps user administration admin-only", () => {
|
||||
assert.equal(getConfigRedirect("/config/benutzer", false), "/config/konto");
|
||||
assert.deepEqual(getConfigTabs(true), [
|
||||
{ href: "/config/benutzer", label: "Benutzer" },
|
||||
{ href: "/config/konto", label: "Konto" },
|
||||
]);
|
||||
assert.deepEqual(getConfigEntry(true), { href: "/config/benutzer", label: "Config" });
|
||||
assert.equal(getConfigRedirect("/config/benutzer", true), null);
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue