From 7584d2d7a7110aef0331ebfa178b2295842c59fa Mon Sep 17 00:00:00 2001 From: MCMXC <16797721+mcmxcdev@users.noreply.github.com> Date: Sat, 10 Feb 2024 18:19:14 -0700 Subject: refactor: project maintenance - work in progress --- tests/functional/dashboard/data.spec.ts | 38 ++++++++++++++------------------- 1 file changed, 16 insertions(+), 22 deletions(-) (limited to 'tests/functional/dashboard/data.spec.ts') 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 @@ -import { test } from '@japa/runner'; -import UserFactory from 'Database/factories/UserFactory'; +import { test } from '@japa/runner' +import UserFactory from '#database/factories/UserFactory' test.group('Dashboard / Data page', () => { - test('redirects to /user/login when accessing /user/data as guest', async ({ - client, - }) => { - const response = await client.get('/user/data'); + test('redirects to /user/login when accessing /user/data as guest', async ({ client }) => { + const response = await client.get('/user/data') - response.assertRedirectsTo('/user/login'); // Check if it redirects to the expected URL - }); + response.assertRedirectsTo('/user/login') // Check if it redirects to the expected URL + }) test('ensure the correct data is shown on the page', async ({ client }) => { - const user = await UserFactory.create(); - const response = await client.get('/user/data').loginAs(user); + const user = await UserFactory.create() + const response = await client.get('/user/data').loginAs(user) - response.assertStatus(200); - response.assertTextIncludes(user.email); - response.assertTextIncludes(user.username); - response.assertTextIncludes(user.lastname); - response.assertTextIncludes( - user.created_at.toFormat('yyyy-MM-dd HH:mm:ss'), - ); - response.assertTextIncludes( - user.updated_at.toFormat('yyyy-MM-dd HH:mm:ss'), - ); - }); + response.assertStatus(200) + response.assertTextIncludes(user.email) + response.assertTextIncludes(user.username) + response.assertTextIncludes(user.lastname) + response.assertTextIncludes(user.created_at.toFormat('yyyy-MM-dd HH:mm:ss')) + response.assertTextIncludes(user.updated_at.toFormat('yyyy-MM-dd HH:mm:ss')) + }) // TODO: Add test to include services. // TODO: Add test to include workspaces. -}); +}) -- cgit v1.2.3-70-g09d2