a81a450e7e
Merged into tinqs/studio: - cmd/tinqs-cli/ — tinqs-cli (Go binary, from bot/cli) - cmd/tea/ — Gitea CLI tool (from tinqs/cli-tea) - services/bot/ — Bot service (from tinqs-ltd/bot on git.arikigame.com) - services/admin/ — Admin panel (from tinqs/admin) - services/team-tool/ — Team Tool (from tinqs/team-tool) - services/proxy/ — tinqs-proxy (from bot/proxy) - web/landing/ — tinqs.com website (from tinqs/website) - web/docs/ — Platform docs (from tinqs/docs) - web/blog/ — Blog (placeholder) - runner/ — Ephemeral CI runner (from tinqs/runner) All source repos will be deleted after verification.
29 lines
909 B
TypeScript
29 lines
909 B
TypeScript
import { describe, it, expect, vi, beforeEach } from "vitest";
|
|
|
|
beforeEach(() => {
|
|
vi.resetModules();
|
|
});
|
|
|
|
describe("middleware auth logic", () => {
|
|
it("allows requests with tailscale-user-login header", () => {
|
|
const headers = new Headers({ "tailscale-user-login": "ozan@tinqs.com" });
|
|
const hasTsLogin = headers.get("tailscale-user-login");
|
|
expect(hasTsLogin).toBe("ozan@tinqs.com");
|
|
});
|
|
|
|
it("rejects requests without any auth in production", () => {
|
|
const headers = new Headers({});
|
|
const hasTsLogin = headers.get("tailscale-user-login");
|
|
const isDev = false;
|
|
const allowBypass = false;
|
|
expect(hasTsLogin || isDev || allowBypass).toBeFalsy();
|
|
});
|
|
|
|
it("allows dev mode bypass", () => {
|
|
const headers = new Headers({});
|
|
const hasTsLogin = headers.get("tailscale-user-login");
|
|
const isDev = true;
|
|
expect(hasTsLogin || isDev).toBeTruthy();
|
|
});
|
|
});
|