Fix tests

This commit is contained in:
Bubka 2024-05-29 09:27:56 +02:00
parent 178dba6a03
commit 9e13cc927f
2 changed files with 16 additions and 4 deletions

View File

@ -544,9 +544,8 @@ public function test_demote_the_only_admin_returns_forbidden() : void
/** /**
* @test * @test
*/ */
public function test_authentications_returns_all_entries() : void public function test_authentications_returns_all_preserved_entries() : void
{ {
AuthLog::factory()->for($this->user, 'authenticatable')->beforeLastYear()->create();
AuthLog::factory()->for($this->user, 'authenticatable')->duringLastYear()->create(); AuthLog::factory()->for($this->user, 'authenticatable')->duringLastYear()->create();
AuthLog::factory()->for($this->user, 'authenticatable')->duringLastSixMonth()->create(); AuthLog::factory()->for($this->user, 'authenticatable')->duringLastSixMonth()->create();
AuthLog::factory()->for($this->user, 'authenticatable')->duringLastThreeMonth()->create(); AuthLog::factory()->for($this->user, 'authenticatable')->duringLastThreeMonth()->create();
@ -558,7 +557,20 @@ public function test_authentications_returns_all_entries() : void
$this->actingAs($this->admin, 'api-guard') $this->actingAs($this->admin, 'api-guard')
->json('GET', '/api/v1/users/' . $this->user->id . '/authentications') ->json('GET', '/api/v1/users/' . $this->user->id . '/authentications')
->assertOk() ->assertOk()
->assertJsonCount(8); ->assertJsonCount(7);
}
/**
* @test
*/
public function test_authentications_does_not_return_old_entries() : void
{
AuthLog::factory()->for($this->user, 'authenticatable')->beforeLastYear()->create();
$this->actingAs($this->admin, 'api-guard')
->json('GET', '/api/v1/users/' . $this->user->id . '/authentications')
->assertOk()
->assertJsonCount(0);
} }
/** /**

File diff suppressed because one or more lines are too long