🛠️ Remove deprecated Forge deployment workflow, add logic for fetching missing highscore names via Nostr, and update API routes with refined highscore endpoints.

This commit is contained in:
HolgerHatGarKeineNode
2026-02-02 12:36:00 +01:00
parent 6dd04dee30
commit bb84117fd1
4 changed files with 106 additions and 22 deletions

View File

@@ -1,5 +1,6 @@
<?php
use App\Http\Controllers\Api\HighscoreController;
use App\Models\Highscore;
use Carbon\CarbonImmutable;
@@ -66,6 +67,35 @@ test('highscore submission updates existing attempt for same npub and datetime',
$this->assertSame(1, Highscore::query()->count());
});
test('missing name is fetched from nostr when available', function () {
$fetchedName = 'Fetched Player';
$controllerMock = \Mockery::mock(HighscoreController::class)->makePartial();
$controllerMock->shouldAllowMockingProtectedMethods();
$controllerMock->shouldReceive('fetchNostrName')->once()->andReturn($fetchedName);
app()->instance(HighscoreController::class, $controllerMock);
$payload = [
'npub' => 'npub1fetchnamevalue',
'satoshis' => 1337,
'blocks' => 2,
'datetime' => CarbonImmutable::now()->subMinute()->toIso8601String(),
];
$response = $this->postJson(route('api.highscores.store'), $payload);
$response->assertAccepted()
->assertJsonPath('data.name', $fetchedName);
$this->assertDatabaseHas('highscores', [
'npub' => $payload['npub'],
'name' => $fetchedName,
'satoshis' => $payload['satoshis'],
'blocks' => $payload['blocks'],
]);
});
test('highscore submission does not clear existing name when omitted', function () {
$datetime = CarbonImmutable::now()->subMinutes(15);