diff options
author | MCMXC <16797721+mcmxcdev@users.noreply.github.com> | 2024-02-10 18:37:40 -0700 |
---|---|---|
committer | Vijay A <vraravam@users.noreply.github.com> | 2024-02-13 06:59:44 +0530 |
commit | e1c47572a6235fd8fd20af888ac3a11c7ae1369d (patch) | |
tree | 2dccff36a441916d7014037cef3f7ce84a790cad /tests/functional/dashboard/data.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/data.spec.ts')
-rw-r--r-- | tests/functional/dashboard/data.spec.ts | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/tests/functional/dashboard/data.spec.ts b/tests/functional/dashboard/data.spec.ts index 150229a..edca3ec 100644 --- a/tests/functional/dashboard/data.spec.ts +++ b/tests/functional/dashboard/data.spec.ts | |||
@@ -1,25 +1,31 @@ | |||
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 / Data page', () => { | 4 | test.group('Dashboard / Data page', () => { |
5 | test('redirects to /user/login when accessing /user/data as guest', async ({ client }) => { | 5 | test('redirects to /user/login when accessing /user/data as guest', async ({ |
6 | const response = await client.get('/user/data') | 6 | client, |
7 | }) => { | ||
8 | const response = await client.get('/user/data'); | ||
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('ensure the correct data is shown on the page', async ({ client }) => { | 13 | test('ensure the correct data is shown on the page', async ({ client }) => { |
12 | const user = await UserFactory.create() | 14 | const user = await UserFactory.create(); |
13 | const response = await client.get('/user/data').loginAs(user) | 15 | const response = await client.get('/user/data').loginAs(user); |
14 | 16 | ||
15 | response.assertStatus(200) | 17 | response.assertStatus(200); |
16 | response.assertTextIncludes(user.email) | 18 | response.assertTextIncludes(user.email); |
17 | response.assertTextIncludes(user.username) | 19 | response.assertTextIncludes(user.username); |
18 | response.assertTextIncludes(user.lastname) | 20 | response.assertTextIncludes(user.lastname); |
19 | response.assertTextIncludes(user.created_at.toFormat('yyyy-MM-dd HH:mm:ss')) | 21 | response.assertTextIncludes( |
20 | response.assertTextIncludes(user.updated_at.toFormat('yyyy-MM-dd HH:mm:ss')) | 22 | user.created_at.toFormat('yyyy-MM-dd HH:mm:ss'), |
21 | }) | 23 | ); |
24 | response.assertTextIncludes( | ||
25 | user.updated_at.toFormat('yyyy-MM-dd HH:mm:ss'), | ||
26 | ); | ||
27 | }); | ||
22 | 28 | ||
23 | // TODO: Add test to include services. | 29 | // TODO: Add test to include services. |
24 | // TODO: Add test to include workspaces. | 30 | // TODO: Add test to include workspaces. |
25 | }) | 31 | }); |