aboutsummaryrefslogtreecommitdiffstats
path: root/tests/functional/dashboard/logout.spec.ts
diff options
context:
space:
mode:
authorLibravatar MCMXC <16797721+mcmxcdev@users.noreply.github.com>2024-02-10 18:37:40 -0700
committerLibravatar Vijay A <vraravam@users.noreply.github.com>2024-02-13 06:59:44 +0530
commite1c47572a6235fd8fd20af888ac3a11c7ae1369d (patch)
tree2dccff36a441916d7014037cef3f7ce84a790cad /tests/functional/dashboard/logout.spec.ts
parentrefactor: project maintenance (diff)
downloadferdium-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.ts26
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 @@
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 ({ 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});