feat: remove test
This commit is contained in:
parent
7a71652bf1
commit
eb471b5ded
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
use App\Models\User;
|
||||
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
|
||||
test('leaderboard endpoint returns users sorted by xp in descending order', function () {
|
||||
// Create users with different XP
|
||||
$user1 = User::factory()->create(['xp' => 100, 'username' => 'User1']);
|
||||
$user2 = User::factory()->create(['xp' => 300, 'username' => 'User2']);
|
||||
$user3 = User::factory()->create(['xp' => 200, 'username' => 'User3']);
|
||||
|
||||
// Authenticate as one of the users
|
||||
$this->actingAs($user1);
|
||||
|
||||
// Call the endpoint
|
||||
$response = $this->getJson('/api/users/leaderboard');
|
||||
|
||||
// Assert response status
|
||||
$response->assertOk();
|
||||
|
||||
// Assert the order of users in the response
|
||||
$response->assertJson(fn ($json) =>
|
||||
$json->has(3)
|
||||
->where('0.id', $user2->id) // 300 XP
|
||||
->where('1.id', $user3->id) // 200 XP
|
||||
->where('2.id', $user1->id) // 100 XP
|
||||
);
|
||||
});
|
||||
Loading…
Reference in New Issue