From 0eaad219114239b693a68110a42b984a4f4f5b29 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Mon, 2 Jan 2023 20:25:51 +0100 Subject: Continue adding tests --- tests/root.spec.js | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 tests/root.spec.js (limited to 'tests/root.spec.js') diff --git a/tests/root.spec.js b/tests/root.spec.js new file mode 100644 index 0000000..ffceda5 --- /dev/null +++ b/tests/root.spec.js @@ -0,0 +1,35 @@ +import { beforeEach, describe, it } from "vitest"; +import supertest from "supertest"; + +import app from "../main.js"; + +const request = supertest(app); + +describe.concurrent("Root handlers tests", async function() { + describe.concurrent("When not logged in", async function() { + it("/", async function() { request.get("/").expect("Content-Type", /text\/plain/).expect(302, /Redirecting to \/login$/); }); + it("/login", async function() { request.get("/login").expect("Content-Type", /text\/html/).expect(200, /