From 3acf783d948ebb1907da875ef87b0da9ef2309ff Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Sun, 1 Jan 2023 23:23:57 +0100 Subject: Began adding tests --- test/root.js | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 test/root.js (limited to 'test') diff --git a/test/root.js b/test/root.js new file mode 100644 index 0000000..d5af081 --- /dev/null +++ b/test/root.js @@ -0,0 +1,91 @@ +import test from "ava"; +import supertest from "supertest"; + +import app from "../main.js"; + +const request = supertest(app); + +test("get / when not logged should redirect to /login", async function(t) { + await request.get("/") + .expect("Content-Type", /text\/plain/) + .expect(302, /Redirecting to \/login$/); + t.pass(); +}); +test("get /login when not logged in should display the login page", async function(t) { + await request.get("/login") + .expect("Content-Type", /text\/html/) + .expect(200, /