import { afterEach, describe, expect, it } from "vitest"; import { createRevocationList, SESSION_TTL_MS } from "../src/session.ts"; import { hashPassword } from "../src/users.ts"; import { cookieFrom, startApp, type TestApp } from "./helpers.ts"; let app: TestApp; afterEach(() => app?.close()); const expectRedirectToLogin = (response: Response) => { expect(response.status).toBe(303); expect(response.headers.get("location")).toBe("/login"); }; describe("Requirement: Страница входа", () => { it("Scenario: Вошедший пользователь открывает страницу входа", async () => { app = await startApp(); const cookie = await app.signIn("anna", "s3cret-pass"); const response = await app.get("/login", { cookie }); expect(response.status).toBe(303); expect(response.headers.get("location")).toBe("/"); expect(await response.text()).not.toContain("