diff --git a/tests/Unit/Endpoint/Api/V1/ClientEndpointTest.php b/tests/Unit/Endpoint/Api/V1/ClientEndpointTest.php index f2cf0fce..ee31af98 100644 --- a/tests/Unit/Endpoint/Api/V1/ClientEndpointTest.php +++ b/tests/Unit/Endpoint/Api/V1/ClientEndpointTest.php @@ -45,7 +45,7 @@ class ClientEndpointTest extends ApiEndpointTestAbstract // Assert $response->assertStatus(200); $response->assertJsonCount(4, 'data'); - $clients = Client::query()->orderBy('created_at', 'desc')->get(); + $clients = Client::query()->orderBy('created_at', 'desc')->orderBy('id')->get(); $response->assertJson(fn (AssertableJson $json) => $json ->has('data') ->has('links') @@ -84,9 +84,12 @@ class ClientEndpointTest extends ApiEndpointTestAbstract ->has('links') ->has('meta') ->count('data', 2) - ->where('data.0.id', $clients->get(0)->getKey()) - ->where('data.1.id', $clients->get(1)->getKey()) ); + // Both clients share the same created_at, so their relative order is not defined. + $this->assertEqualsCanonicalizing([ + $clients->get(0)->getKey(), + $clients->get(1)->getKey(), + ], $response->json('data.*.id')); } public function test_index_endpoint_without_filter_archived_returns_only_non_archived_clients(): void diff --git a/tests/Unit/Endpoint/Api/V1/ReportEndpointTest.php b/tests/Unit/Endpoint/Api/V1/ReportEndpointTest.php index de8eb90b..96ac9ba0 100644 --- a/tests/Unit/Endpoint/Api/V1/ReportEndpointTest.php +++ b/tests/Unit/Endpoint/Api/V1/ReportEndpointTest.php @@ -51,7 +51,7 @@ class ReportEndpointTest extends ApiEndpointTestAbstract // Assert $response->assertStatus(200); $response->assertJsonCount(4, 'data'); - $reports = Report::query()->orderBy('created_at', 'desc')->get(); + $reports = Report::query()->orderBy('created_at', 'desc')->orderBy('id')->get(); $response->assertJson(fn (AssertableJson $json) => $json ->has('data') ->has('links') diff --git a/tests/Unit/Endpoint/Api/V1/TagEndpointTest.php b/tests/Unit/Endpoint/Api/V1/TagEndpointTest.php index d3b35f2a..675cb37a 100644 --- a/tests/Unit/Endpoint/Api/V1/TagEndpointTest.php +++ b/tests/Unit/Endpoint/Api/V1/TagEndpointTest.php @@ -44,7 +44,7 @@ class TagEndpointTest extends ApiEndpointTestAbstract // Assert $response->assertStatus(200); $response->assertJsonCount(4, 'data'); - $tags = Tag::query()->orderBy('created_at', 'desc')->get(); + $tags = Tag::query()->orderBy('created_at', 'desc')->orderBy('id')->get(); $response->assertJson(fn (AssertableJson $json) => $json ->has('data') ->has('links')