Skip to content

Commit

Permalink
change in test case
Browse files Browse the repository at this point in the history
  • Loading branch information
bhargavraviya committed Sep 2, 2023
1 parent dc7cf10 commit bacc052
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions stubs/auth/tests/Feature/Auth/LoginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Tests\Feature\Auth;

use App\Models\User;
use App\Livewire\Auth\Login;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
Expand All @@ -18,7 +19,7 @@ public function can_view_login_page()
{
$this->get(route('login'))
->assertSuccessful()
->assertSeeLivewire('auth.login');
->assertSeeLivewire(Login::class);
}

/** @test */
Expand All @@ -37,7 +38,7 @@ public function a_user_can_login()
{
$user = User::factory()->create(['password' => Hash::make('password')]);

Livewire::test('auth.login')
Livewire::test(Login::class)
->set('email', $user->email)
->set('password', 'password')
->call('authenticate');
Expand All @@ -50,7 +51,7 @@ public function is_redirected_to_the_home_page_after_login()
{
$user = User::factory()->create(['password' => Hash::make('password')]);

Livewire::test('auth.login')
Livewire::test(Login::class)
->set('email', $user->email)
->set('password', 'password')
->call('authenticate')
Expand All @@ -62,7 +63,7 @@ public function email_is_required()
{
$user = User::factory()->create(['password' => Hash::make('password')]);

Livewire::test('auth.login')
Livewire::test(Login::class)
->set('password', 'password')
->call('authenticate')
->assertHasErrors(['email' => 'required']);
Expand All @@ -73,7 +74,7 @@ public function email_must_be_valid_email()
{
$user = User::factory()->create(['password' => Hash::make('password')]);

Livewire::test('auth.login')
Livewire::test(Login::class)
->set('email', 'invalid-email')
->set('password', 'password')
->call('authenticate')
Expand All @@ -85,7 +86,7 @@ public function password_is_required()
{
$user = User::factory()->create(['password' => Hash::make('password')]);

Livewire::test('auth.login')
Livewire::test(Login::class)
->set('email', $user->email)
->call('authenticate')
->assertHasErrors(['password' => 'required']);
Expand All @@ -96,7 +97,7 @@ public function bad_login_attempt_shows_message()
{
$user = User::factory()->create();

Livewire::test('auth.login')
Livewire::test(Login::class)
->set('email', $user->email)
->set('password', 'bad-password')
->call('authenticate')
Expand Down

0 comments on commit bacc052

Please sign in to comment.