mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-app.git
synced 2026-06-11 02:50:29 +00:00
🔥 **Remove Highscore and Bindle features**
- 🗑️ Deleted `Highscore` feature (Model, Controller, Factory, Tests, Routes, Migrations) and associated logic. - 🗑️ Removed `BindleController` and its related test. - 🧹 Cleaned up unused routes, database seeders, and localization references. - 🚫 Deprecated inactive book rental guide component and associated views.
This commit is contained in:
@@ -1,71 +0,0 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Highscore;
|
||||
|
||||
it('returns all highscores ordered by satoshis desc on GET /api/highscores', function () {
|
||||
Highscore::factory()->create(['satoshis' => 100, 'achieved_at' => now()->subHours(1)]);
|
||||
Highscore::factory()->create(['satoshis' => 5000, 'achieved_at' => now()->subHours(2)]);
|
||||
Highscore::factory()->create(['satoshis' => 1000, 'achieved_at' => now()->subHours(3)]);
|
||||
|
||||
$response = $this->getJson('/api/highscores');
|
||||
|
||||
$response->assertSuccessful();
|
||||
$data = $response->json('data');
|
||||
expect(collect($data)->pluck('satoshis')->all())->toBe([5000, 1000, 100]);
|
||||
});
|
||||
|
||||
it('accepts a valid highscore submission', function () {
|
||||
$payload = [
|
||||
'npub' => 'npub1'.str_repeat('a', 58),
|
||||
'name' => 'Tester',
|
||||
'satoshis' => 1234,
|
||||
'blocks' => 5,
|
||||
'datetime' => now()->subDay()->toIso8601String(),
|
||||
];
|
||||
|
||||
$this->postJson('/api/highscores', $payload)
|
||||
->assertStatus(202)
|
||||
->assertJsonPath('data.satoshis', 1234)
|
||||
->assertJsonPath('data.name', 'Tester');
|
||||
|
||||
expect(Highscore::query()->where('npub', $payload['npub'])->exists())->toBeTrue();
|
||||
});
|
||||
|
||||
it('rejects a highscore submission missing npub', function () {
|
||||
$this->postJson('/api/highscores', [
|
||||
'satoshis' => 1234,
|
||||
'blocks' => 5,
|
||||
'datetime' => now()->toIso8601String(),
|
||||
])->assertUnprocessable()
|
||||
->assertJsonValidationErrors(['npub']);
|
||||
});
|
||||
|
||||
it('rejects a highscore submission with an npub that does not start with npub1', function () {
|
||||
$this->postJson('/api/highscores', [
|
||||
'npub' => 'nsec1'.str_repeat('a', 58),
|
||||
'satoshis' => 1234,
|
||||
'blocks' => 5,
|
||||
'datetime' => now()->toIso8601String(),
|
||||
])->assertUnprocessable()
|
||||
->assertJsonValidationErrors(['npub']);
|
||||
});
|
||||
|
||||
it('rejects a highscore submission with negative satoshis', function () {
|
||||
$this->postJson('/api/highscores', [
|
||||
'npub' => 'npub1'.str_repeat('b', 58),
|
||||
'satoshis' => -10,
|
||||
'blocks' => 5,
|
||||
'datetime' => now()->toIso8601String(),
|
||||
])->assertUnprocessable()
|
||||
->assertJsonValidationErrors(['satoshis']);
|
||||
});
|
||||
|
||||
it('rejects a highscore submission with an invalid datetime', function () {
|
||||
$this->postJson('/api/highscores', [
|
||||
'npub' => 'npub1'.str_repeat('c', 58),
|
||||
'satoshis' => 100,
|
||||
'blocks' => 5,
|
||||
'datetime' => 'not-a-date',
|
||||
])->assertUnprocessable()
|
||||
->assertJsonValidationErrors(['datetime']);
|
||||
});
|
||||
@@ -1,6 +1,5 @@
|
||||
<?php
|
||||
|
||||
use App\Models\LibraryItem;
|
||||
use App\Models\User;
|
||||
|
||||
it('returns nostr-pubkeys in /api/nostrplebs', function () {
|
||||
@@ -15,16 +14,3 @@ it('returns nostr-pubkeys in /api/nostrplebs', function () {
|
||||
->toHaveCount(2)
|
||||
->each->toStartWith('npub1');
|
||||
});
|
||||
|
||||
it('returns bindle-type library items in /api/bindles', function () {
|
||||
LibraryItem::factory()->create(['type' => 'bindle', 'name' => 'My Bindle']);
|
||||
LibraryItem::factory()->create(['type' => 'article', 'name' => 'My Article']);
|
||||
|
||||
$response = $this->getJson('/api/bindles');
|
||||
|
||||
$response->assertSuccessful();
|
||||
$names = collect($response->json())->pluck('name');
|
||||
expect($names->all())
|
||||
->toContain('My Bindle')
|
||||
->not->toContain('My Article');
|
||||
});
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
<?php
|
||||
|
||||
use App\Livewire\BooksForPlebs\BookRentalGuide;
|
||||
use Illuminate\View\ViewException;
|
||||
use Livewire\Livewire;
|
||||
|
||||
it('mounts the BookRentalGuide component but its view references a route that is currently commented out in routes/web.php', function () {
|
||||
expect(fn () => Livewire::test(BookRentalGuide::class)->assertStatus(200))
|
||||
->toThrow(ViewException::class, 'Route [buecherverleih.download] not defined.');
|
||||
})->skip('Component is unreachable: /buecherverleih route is commented out in routes/web.php — view references the missing buecherverleih.download route.');
|
||||
|
||||
it('confirms the BookRentalGuide component class still exists', function () {
|
||||
expect(class_exists(BookRentalGuide::class))->toBeTrue();
|
||||
});
|
||||
@@ -9,7 +9,6 @@ use App\Models\CourseEvent;
|
||||
use App\Models\EmailCampaign;
|
||||
use App\Models\EmailTexts;
|
||||
use App\Models\Episode;
|
||||
use App\Models\Highscore;
|
||||
use App\Models\Lecturer;
|
||||
use App\Models\Library;
|
||||
use App\Models\LibraryItem;
|
||||
@@ -62,7 +61,6 @@ it('creates a valid persisted record via the factory', function (string $modelCl
|
||||
'Participant' => Participant::class,
|
||||
'EmailCampaign' => EmailCampaign::class,
|
||||
'EmailTexts' => EmailTexts::class,
|
||||
'Highscore' => Highscore::class,
|
||||
'LoginKey' => LoginKey::class,
|
||||
'Tag' => Tag::class,
|
||||
]);
|
||||
|
||||
@@ -4,9 +4,7 @@ use App\Models\City;
|
||||
use App\Models\Country;
|
||||
use App\Models\Course;
|
||||
use App\Models\CourseEvent;
|
||||
use App\Models\Highscore;
|
||||
use App\Models\Lecturer;
|
||||
use App\Models\LibraryItem;
|
||||
use App\Models\Meetup;
|
||||
use App\Models\MeetupEvent;
|
||||
use App\Models\User;
|
||||
@@ -21,8 +19,6 @@ beforeEach(function () {
|
||||
Course::factory()->create();
|
||||
CourseEvent::factory()->create();
|
||||
Lecturer::factory()->create();
|
||||
Highscore::factory()->create();
|
||||
LibraryItem::factory()->create(['type' => 'bindle']);
|
||||
User::factory()->create(['nostr' => 'npub1'.str_repeat('a', 58)]);
|
||||
});
|
||||
|
||||
@@ -34,12 +30,10 @@ it('returns a JSON response for the API GET endpoint', function (string $path) {
|
||||
'meetup events' => '/api/meetup-events',
|
||||
'btc-map communities' => '/api/btc-map-communities',
|
||||
'nostrplebs' => '/api/nostrplebs',
|
||||
'bindles' => '/api/bindles',
|
||||
'lecturers' => '/api/lecturers',
|
||||
'courses' => '/api/courses',
|
||||
'cities' => '/api/cities',
|
||||
'venues' => '/api/venues',
|
||||
'highscores' => '/api/highscores',
|
||||
]);
|
||||
|
||||
it('returns 404 for /api/meetup/ical (currently a stub that aborts)', function () {
|
||||
|
||||
Reference in New Issue
Block a user