aboutsummaryrefslogtreecommitdiffstats
path: root/tests/functional/dashboard/data.spec.ts
diff options
context:
space:
mode:
Diffstat (limited to 'tests/functional/dashboard/data.spec.ts')
-rw-r--r--tests/functional/dashboard/data.spec.ts38
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 @@
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 / Data page', () => { 4test.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})