summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJulien Dessaux2023-01-05 02:09:07 +0100
committerJulien Dessaux2023-01-05 02:09:07 +0100
commitd7ed1196bdd44d7734d41d91a5e72a71785e0a08 (patch)
treeaafae6571d5154dc5e9a061c8f54ca8e9b1287ad /test
parentAdded more tests (diff)
downloadjeux-de-mots-d7ed1196bdd44d7734d41d91a5e72a71785e0a08.tar.gz
jeux-de-mots-d7ed1196bdd44d7734d41d91a5e72a71785e0a08.tar.bz2
jeux-de-mots-d7ed1196bdd44d7734d41d91a5e72a71785e0a08.zip
switched to single quotes string in eslint
Diffstat (limited to '')
-rw-r--r--tests/games.spec.js30
-rw-r--r--tests/root.spec.js44
2 files changed, 37 insertions, 37 deletions
diff --git a/tests/games.spec.js b/tests/games.spec.js
index 00ae1e7..1d5333c 100644
--- a/tests/games.spec.js
+++ b/tests/games.spec.js
@@ -1,23 +1,23 @@
-import { beforeEach, describe, test } from "vitest";
-import supertest from "supertest";
+import { beforeEach, describe, test } from 'vitest';
+import supertest from 'supertest';
-import app from "../main.js";
+import app from '../main.js';
-describe.concurrent("Games handlers tests", function() {
- describe.concurrent("When not logged in", function() {
- test("GET /games", async function() { await supertest(app).get("/games").expect("Content-Type", /text\/plain/).expect(302, /Redirecting to \/login$/); });
- test("GET /games/1", async function() { await supertest(app).get("/games").expect("Content-Type", /text\/plain/).expect(302, /Redirecting to \/login$/); });
+describe.concurrent('Games handlers tests', function() {
+ describe.concurrent('When not logged in', function() {
+ test('GET /games', async function() { await supertest(app).get('/games').expect('Content-Type', /text\/plain/).expect(302, /Redirecting to \/login$/); });
+ test('GET /games/1', async function() { await supertest(app).get('/games').expect('Content-Type', /text\/plain/).expect(302, /Redirecting to \/login$/); });
});
- describe.concurrent("With valid credentials", function() {
+ describe.concurrent('With valid credentials', function() {
beforeEach(async function(ctx) {
- const authResponse = await supertest(app).post("/login")
- .send("username=Alice&password=Alice42!")
- .expect("Content-Type", /text\/plain/)
- .expect("set-cookie", /JDMSessionId=/)
+ const authResponse = await supertest(app).post('/login')
+ .send('username=Alice&password=Alice42!')
+ .expect('Content-Type', /text\/plain/)
+ .expect('set-cookie', /JDMSessionId=/)
.expect(302, /Redirecting to \/games$/);
- ctx.cookie = authResponse.get("Set-Cookie");
+ ctx.cookie = authResponse.get('Set-Cookie');
});
- test("GET /games", async function(ctx) { await supertest(app).get("/games").set("Cookie", ctx.cookie).expect("Content-Type", /text\/html/).expect(200, /<td><a href="\/games\/1">Alice vs Bob<\/a><\/td>/); });
- test("GET /games/1", async function(ctx) { await supertest(app).get("/games/1").set("Cookie", ctx.cookie).expect("Content-Type", /text\/html/).expect(200, /<h2>Alice vs Bob<\/h2>/); });
+ test('GET /games', async function(ctx) { await supertest(app).get('/games').set('Cookie', ctx.cookie).expect('Content-Type', /text\/html/).expect(200, /<td><a href="\/games\/1">Alice vs Bob<\/a><\/td>/); });
+ test('GET /games/1', async function(ctx) { await supertest(app).get('/games/1').set('Cookie', ctx.cookie).expect('Content-Type', /text\/html/).expect(200, /<h2>Alice vs Bob<\/h2>/); });
});
});
diff --git a/tests/root.spec.js b/tests/root.spec.js
index 308d35c..34a8328 100644
--- a/tests/root.spec.js
+++ b/tests/root.spec.js
@@ -1,36 +1,36 @@
-import { beforeEach, describe, it } from "vitest";
-import supertest from "supertest";
+import { beforeEach, describe, it } from 'vitest';
+import supertest from 'supertest';
-import app from "../main.js";
+import app from '../main.js';
const request = supertest(app);
-describe.concurrent("Root handlers tests", function() {
- describe.concurrent("When not logged in", function() {
- it("GET /", async function() { await request.get("/").expect("Content-Type", /text\/plain/).expect(302, /Redirecting to \/login$/); });
- it("GET /login", async function() { await request.get("/login").expect("Content-Type", /text\/html/).expect(200, /<form action="\/login" method="post">/); });
- it("GET /logout", async function() { await request.get("/logout").expect("Content-Type", /text\/plain/).expect(302, /Redirecting to \/$/); });
+describe.concurrent('Root handlers tests', function() {
+ describe.concurrent('When not logged in', function() {
+ it('GET /', async function() { await request.get('/').expect('Content-Type', /text\/plain/).expect(302, /Redirecting to \/login$/); });
+ it('GET /login', async function() { await request.get('/login').expect('Content-Type', /text\/html/).expect(200, /<form action="\/login" method="post">/); });
+ it('GET /logout', async function() { await request.get('/logout').expect('Content-Type', /text\/plain/).expect(302, /Redirecting to \/$/); });
});
- describe.concurrent("With valid credentials", function() {
+ describe.concurrent('With valid credentials', function() {
beforeEach(async function(ctx) {
- const authResponse = await request.post("/login")
- .send("username=Alice&password=Alice42!")
- .expect("Content-Type", /text\/plain/)
- .expect("set-cookie", /JDMSessionId=/)
+ const authResponse = await request.post('/login')
+ .send('username=Alice&password=Alice42!')
+ .expect('Content-Type', /text\/plain/)
+ .expect('set-cookie', /JDMSessionId=/)
.expect(302, /Redirecting to \/games$/);
- ctx.cookie = authResponse.get("Set-Cookie");
+ ctx.cookie = authResponse.get('Set-Cookie');
});
- it("GET /", async function(ctx) { await request.get("/").set("Cookie", ctx.cookie).expect("Content-Type", /text\/plain/).expect(302, /Redirecting to \/games$/); });
- it("GET /login", async function(ctx) { await request.get("/login").set("Cookie", ctx.cookie).expect("Content-Type", /text\/plain/).expect(302, /Redirecting to \/games$/); });
- describe("logout", function() {
+ it('GET /', async function(ctx) { await request.get('/').set('Cookie', ctx.cookie).expect('Content-Type', /text\/plain/).expect(302, /Redirecting to \/games$/); });
+ it('GET /login', async function(ctx) { await request.get('/login').set('Cookie', ctx.cookie).expect('Content-Type', /text\/plain/).expect(302, /Redirecting to \/games$/); });
+ describe('logout', function() {
beforeEach(async function(ctx) {
- await request.get("/logout").set("cookie", ctx.cookie).expect("content-type", /text\/plain/).expect("set-cookie", /JDMSessionId=;/).expect(302, /Redirecting to \/$/);
+ await request.get('/logout').set('cookie', ctx.cookie).expect('content-type', /text\/plain/).expect('set-cookie', /JDMSessionId=;/).expect(302, /Redirecting to \/$/);
});
- describe.concurrent("all handlers with the now invalid cookie", async function() {
- it("GET /", async function(ctx) { await request.get("/").set("Cookie", ctx.cookie).expect("Content-Type", /text\/plain/).expect(302, /Redirecting to \/login$/); });
- it("GET /login", async function(ctx) { await request.get("/login").set("Cookie", ctx.cookie).expect("Content-Type", /text\/html/).expect(200, /<form action="\/login" method="post">/); });
- it("GET /logout", async function(ctx) { await request.get("/logout").set("Cookie", ctx.cookie).expect("Content-Type", /text\/plain/).expect(302, /Redirecting to \/$/); });
+ describe.concurrent('all handlers with the now invalid cookie', async function() {
+ it('GET /', async function(ctx) { await request.get('/').set('Cookie', ctx.cookie).expect('Content-Type', /text\/plain/).expect(302, /Redirecting to \/login$/); });
+ it('GET /login', async function(ctx) { await request.get('/login').set('Cookie', ctx.cookie).expect('Content-Type', /text\/html/).expect(200, /<form action="\/login" method="post">/); });
+ it('GET /logout', async function(ctx) { await request.get('/logout').set('Cookie', ctx.cookie).expect('Content-Type', /text\/plain/).expect(302, /Redirecting to \/$/); });
});
});
});