This commit is contained in:
1 parent
0cf6f62e23
commit
0c12ce5f33
5 files changed
+109
-1
No files matched your search
@@ -1,9 +1,11 @@
|
||||
import assert from "node:assert/strict";
|
||||
import authHelpers from "../auth.js";
|
||||
|
||||
const { getLoginUrlForPath, shouldShowAdminEntry } = authHelpers;
|
||||
const { getLoginUrlForPath, isUnauthorizedStatus, shouldShowAdminEntry } = authHelpers;
|
||||
|
||||
assert.equal(getLoginUrlForPath("/study.html?video=2"), "./login.html?next=%2Fstudy.html%3Fvideo%3D2");
|
||||
assert.equal(isUnauthorizedStatus(401), true);
|
||||
assert.equal(isUnauthorizedStatus(403), false);
|
||||
assert.equal(shouldShowAdminEntry({ role: "admin" }), true);
|
||||
assert.equal(shouldShowAdminEntry({ role: "user" }), false);
|
||||
assert.equal(shouldShowAdminEntry(null), false);
|
||||
Reference in new issue
Block a user