mirror of
https://github.com/gethomepage/homepage.git
synced 2026-09-29 15:31:16 -07:00
Fix: use strict bool check for auth
This commit is contained in:
@@ -100,6 +100,16 @@ describe("middleware", () => {
|
||||
expect(res).toEqual({ type: "next" });
|
||||
});
|
||||
|
||||
it.each(["false", "0", "no", "off", ""])("treats HOMEPAGE_AUTH_ENABLED=%j as disabled", async (value) => {
|
||||
process.env.HOMEPAGE_AUTH_ENABLED = value;
|
||||
|
||||
const middleware = await loadMiddleware();
|
||||
const res = await middleware(createReq("localhost:3000", "http://localhost:3000/some"));
|
||||
|
||||
expect(getToken).not.toHaveBeenCalled();
|
||||
expect(res).toEqual({ type: "next" });
|
||||
});
|
||||
|
||||
it("redirects to signin when auth is enabled and no token is present", async () => {
|
||||
process.env.HOMEPAGE_AUTH_ENABLED = "true";
|
||||
process.env.HOMEPAGE_AUTH_SECRET = "secret";
|
||||
|
||||
Reference in New Issue
Block a user