diff options
author | 2024-02-10 18:19:14 -0700 | |
---|---|---|
committer | 2024-02-13 06:59:44 +0530 | |
commit | 7584d2d7a7110aef0331ebfa178b2295842c59fa (patch) | |
tree | 900cd71237e6231b57936fcce77ff229cd459041 /tests/functional/dashboard/data.spec.ts | |
parent | upgrade recipes submodule (diff) | |
download | ferdium-server-7584d2d7a7110aef0331ebfa178b2295842c59fa.tar.gz ferdium-server-7584d2d7a7110aef0331ebfa178b2295842c59fa.tar.zst ferdium-server-7584d2d7a7110aef0331ebfa178b2295842c59fa.zip |
refactor: project maintenance
- work in progress
Diffstat (limited to 'tests/functional/dashboard/data.spec.ts')
-rw-r--r-- | tests/functional/dashboard/data.spec.ts | 38 |
1 files changed, 16 insertions, 22 deletions
diff --git a/tests/functional/dashboard/data.spec.ts b/tests/functional/dashboard/data.spec.ts index 1a0e7ad..150229a 100644 --- a/tests/functional/dashboard/data.spec.ts +++ b/tests/functional/dashboard/data.spec.ts | |||
@@ -1,31 +1,25 @@ | |||
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 ({ | 5 | test('redirects to /user/login when accessing /user/data as guest', async ({ client }) => { |
6 | client, | 6 | const response = await client.get('/user/data') |
7 | }) => { | ||
8 | const response = await client.get('/user/data'); | ||
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('ensure the correct data is shown on the page', async ({ client }) => { | 11 | test('ensure the correct data is shown on the page', async ({ client }) => { |
14 | const user = await UserFactory.create(); | 12 | const user = await UserFactory.create() |
15 | const response = await client.get('/user/data').loginAs(user); | 13 | const response = await client.get('/user/data').loginAs(user) |
16 | 14 | ||
17 | response.assertStatus(200); | 15 | response.assertStatus(200) |
18 | response.assertTextIncludes(user.email); | 16 | response.assertTextIncludes(user.email) |
19 | response.assertTextIncludes(user.username); | 17 | response.assertTextIncludes(user.username) |
20 | response.assertTextIncludes(user.lastname); | 18 | response.assertTextIncludes(user.lastname) |
21 | response.assertTextIncludes( | 19 | response.assertTextIncludes(user.created_at.toFormat('yyyy-MM-dd HH:mm:ss')) |
22 | user.created_at.toFormat('yyyy-MM-dd HH:mm:ss'), | 20 | response.assertTextIncludes(user.updated_at.toFormat('yyyy-MM-dd HH:mm:ss')) |
23 | ); | 21 | }) |
24 | response.assertTextIncludes( | ||
25 | user.updated_at.toFormat('yyyy-MM-dd HH:mm:ss'), | ||
26 | ); | ||
27 | }); | ||
28 | 22 | ||
29 | // TODO: Add test to include services. | 23 | // TODO: Add test to include services. |
30 | // TODO: Add test to include workspaces. | 24 | // TODO: Add test to include workspaces. |
31 | }); | 25 | }) |