diff options
author | 2024-02-10 18:37:40 -0700 | |
---|---|---|
committer | 2024-02-13 06:59:44 +0530 | |
commit | e1c47572a6235fd8fd20af888ac3a11c7ae1369d (patch) | |
tree | 2dccff36a441916d7014037cef3f7ce84a790cad /tests/functional/dashboard/logout.spec.ts | |
parent | refactor: project maintenance (diff) | |
download | ferdium-server-e1c47572a6235fd8fd20af888ac3a11c7ae1369d.tar.gz ferdium-server-e1c47572a6235fd8fd20af888ac3a11c7ae1369d.tar.zst ferdium-server-e1c47572a6235fd8fd20af888ac3a11c7ae1369d.zip |
updates
Diffstat (limited to 'tests/functional/dashboard/logout.spec.ts')
-rw-r--r-- | tests/functional/dashboard/logout.spec.ts | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/tests/functional/dashboard/logout.spec.ts b/tests/functional/dashboard/logout.spec.ts index ad117da..440a054 100644 --- a/tests/functional/dashboard/logout.spec.ts +++ b/tests/functional/dashboard/logout.spec.ts | |||
@@ -1,19 +1,21 @@ | |||
1 | import { test } from '@japa/runner' | 1 | import { test } from '@japa/runner'; |
2 | import UserFactory from '#database/factories/UserFactory' | 2 | import UserFactory from '#database/factories/UserFactory'; |
3 | 3 | ||
4 | test.group('Dashboard / Log out page', () => { | 4 | test.group('Dashboard / Log out page', () => { |
5 | test('redirects to /user/login when accessing /user/logout as guest', async ({ client }) => { | 5 | test('redirects to /user/login when accessing /user/logout as guest', async ({ |
6 | const response = await client.get('/user/logout') | 6 | client, |
7 | }) => { | ||
8 | const response = await client.get('/user/logout'); | ||
7 | 9 | ||
8 | response.assertRedirectsTo('/user/login') // Check if it redirects to the expected URL | 10 | response.assertRedirectsTo('/user/login'); // Check if it redirects to the expected URL |
9 | }) | 11 | }); |
10 | 12 | ||
11 | test('logs the user out when opening the page', async ({ client }) => { | 13 | test('logs the user out when opening the page', async ({ client }) => { |
12 | const user = await UserFactory.create() | 14 | const user = await UserFactory.create(); |
13 | const response = await client.get('/user/logout').loginAs(user) | 15 | const response = await client.get('/user/logout').loginAs(user); |
14 | 16 | ||
15 | response.assertRedirectsTo('/user/login') | 17 | response.assertRedirectsTo('/user/login'); |
16 | // This asserts the session is deleted as well | 18 | // This asserts the session is deleted as well |
17 | response.assertSessionMissing('auth_web') | 19 | response.assertSessionMissing('auth_web'); |
18 | }) | 20 | }); |
19 | }) | 21 | }); |