From cffa0474dd892c13c3b0deee6d2e14e4637874b7 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Sat, 11 Feb 2023 21:46:06 +0100 Subject: Improved games controller tests --- tests/games.spec.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'tests/games.spec.js') diff --git a/tests/games.spec.js b/tests/games.spec.js index 1d5333c..6ff8788 100644 --- a/tests/games.spec.js +++ b/tests/games.spec.js @@ -6,7 +6,8 @@ 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$/); }); + test('GET /games/1', async function() { await supertest(app).get('/games/1').expect('Content-Type', /text\/plain/).expect(302, /Redirecting to \/login$/); }); + test('GET /games/2', async function() { await supertest(app).get('/games/2').expect('Content-Type', /text\/plain/).expect(302, /Redirecting to \/login$/); }); }); describe.concurrent('With valid credentials', function() { beforeEach(async function(ctx) { @@ -19,5 +20,6 @@ describe.concurrent('Games handlers tests', function() { }); test('GET /games', async function(ctx) { await supertest(app).get('/games').set('Cookie', ctx.cookie).expect('Content-Type', /text\/html/).expect(200, /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, /

Alice vs Bob<\/h2>/); }); + test('GET /games/2', async function(ctx) { await supertest(app).get('/games/2').set('Cookie', ctx.cookie).expect('Content-Type', /text\/plain/).expect(302, /Redirecting to \/games/); }); }); }); -- cgit v1.2.3