Skip to content

Commit

Permalink
adding updated test
Browse files Browse the repository at this point in the history
  • Loading branch information
tnylea committed Oct 17, 2024
1 parent 6d043f7 commit 77df0ec
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 12 deletions.
41 changes: 41 additions & 0 deletions tests/Datasets/AuthRoutes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

dataset('authroutes', function () {
return [
'/',
'/blog',
'/blog/marketing',
'/blog/marketing/best-ways-to-market-your-application',
'/dashboard',
'/profile/admin',
'/notifications',
'/settings/profile',
'/settings/security',
'/settings/api',
'/settings/subscription',
'/settings/invoices',

'/admin',
'/admin/users',
'/admin/users/1/edit',
'/admin/roles',
'/admin/roles/1/edit',
'/admin/permissions',
'/admin/permissions/create',
'/admin/plans',
'/admin/plans/1/edit',
'/admin/posts',
'/admin/posts/5/edit',
'/admin/media',
'/admin/pages',
'/admin/pages/1/edit',
'/admin/categories',
'/admin/categories/1/edit',
'/admin/changelogs',
'/admin/changelogs/3/edit',
'/admin/themes',
'/admin/plugins',
'/admin/settings',
'/admin/settings/1/edit'
];
});
18 changes: 18 additions & 0 deletions tests/Datasets/Routes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

dataset('routes', function () {
return [
'/',
'/blog',
'/blog/marketing',
'/blog/marketing/best-ways-to-market-your-application',
'/pricing',
'/changelog',
'/changelog/4',
'/auth/login',
'/auth/register',
'/auth/password/reset',
'/about',
'/profile/admin'
];
});
7 changes: 0 additions & 7 deletions tests/Feature/ExampleTest.php

This file was deleted.

7 changes: 7 additions & 0 deletions tests/Feature/HomeTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

it('Home returns a successful response', function () {
$response = $this->get('/');
$response->assertStatus(200);
$response->assertSee('Ship in Days');
});
20 changes: 20 additions & 0 deletions tests/Feature/RouteTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

// tests/Feature/RouteResponseTest.php

use function Pest\Laravel\get;

it('responds with 200 for all routes', function (string $route) {
$response = get($route);
$response->assertStatus(200);
})->with('routes');

test('responds with 200 for all auth routes', function ($url) {
$user = \App\Models\User::find(1);

$this->actingAs($user);

$response = $this->get($url);

$response->assertStatus(200);
})->with('authroutes');
5 changes: 0 additions & 5 deletions tests/Unit/ExampleTest.php

This file was deleted.

0 comments on commit 77df0ec

Please sign in to comment.