aboutsummaryrefslogtreecommitdiffstats
path: root/tests/functional/dashboard/logout.spec.ts
diff options
context:
space:
mode:
Diffstat (limited to 'tests/functional/dashboard/logout.spec.ts')
-rw-r--r--tests/functional/dashboard/logout.spec.ts26
1 files changed, 12 insertions, 14 deletions
diff --git a/tests/functional/dashboard/logout.spec.ts b/tests/functional/dashboard/logout.spec.ts
index a45ee72..ad117da 100644
--- a/tests/functional/dashboard/logout.spec.ts
+++ b/tests/functional/dashboard/logout.spec.ts
@@ -1,21 +1,19 @@
1import { test } from '@japa/runner'; 1import { test } from '@japa/runner'
2import UserFactory from 'Database/factories/UserFactory'; 2import UserFactory from '#database/factories/UserFactory'
3 3
4test.group('Dashboard / Log out page', () => { 4test.group('Dashboard / Log out page', () => {
5 test('redirects to /user/login when accessing /user/logout as guest', async ({ 5 test('redirects to /user/login when accessing /user/logout as guest', async ({ client }) => {
6 client, 6 const response = await client.get('/user/logout')
7 }) => {
8 const response = await client.get('/user/logout');
9 7
10 response.assertRedirectsTo('/user/login'); // Check if it redirects to the expected URL 8 response.assertRedirectsTo('/user/login') // Check if it redirects to the expected URL
11 }); 9 })
12 10
13 test('logs the user out when opening the page', async ({ client }) => { 11 test('logs the user out when opening the page', async ({ client }) => {
14 const user = await UserFactory.create(); 12 const user = await UserFactory.create()
15 const response = await client.get('/user/logout').loginAs(user); 13 const response = await client.get('/user/logout').loginAs(user)
16 14
17 response.assertRedirectsTo('/user/login'); 15 response.assertRedirectsTo('/user/login')
18 // This asserts the session is deleted as well 16 // This asserts the session is deleted as well
19 response.assertSessionMissing('auth_web'); 17 response.assertSessionMissing('auth_web')
20 }); 18 })
21}); 19})