mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-app.git
synced 2026-05-03 16:24:55 +00:00
🔥 **Cleanup:** Removed BookCase and OrangePill models, factories, migrations, and related references. Added tests for new service and meetup creation flows. Updated PHPUnit settings and browser-specific configurations.
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
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;
|
||||
use App\Models\Venue;
|
||||
|
||||
beforeEach(function () {
|
||||
$country = Country::factory()->create(['code' => 'de']);
|
||||
$city = City::factory()->create(['country_id' => $country->id]);
|
||||
Venue::factory()->create(['city_id' => $city->id]);
|
||||
Meetup::factory()->create(['city_id' => $city->id, 'community' => 'einundzwanzig', 'visible_on_map' => true]);
|
||||
MeetupEvent::factory()->create();
|
||||
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)]);
|
||||
});
|
||||
|
||||
it('returns a JSON response for the API GET endpoint', function (string $path) {
|
||||
$this->getJson($path)->assertSuccessful();
|
||||
})->with([
|
||||
'countries' => '/api/countries',
|
||||
'meetups' => '/api/meetups',
|
||||
'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 () {
|
||||
$this->get('/api/meetup/ical')->assertNotFound();
|
||||
});
|
||||
|
||||
it('returns 404 for /api/meetup index without user_id (currently aborts on missing param)', function () {
|
||||
$this->getJson('/api/meetup')->assertNotFound();
|
||||
});
|
||||
|
||||
it('returns a successful response for /stream-calendar', function () {
|
||||
$response = $this->get('/stream-calendar');
|
||||
$response->assertSuccessful();
|
||||
});
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
use App\Models\City;
|
||||
use App\Models\Country;
|
||||
use App\Models\Lecturer;
|
||||
use App\Models\Meetup;
|
||||
use App\Models\SelfHostedService;
|
||||
use App\Models\Venue;
|
||||
|
||||
beforeEach(function () {
|
||||
$country = Country::factory()->create(['code' => 'de']);
|
||||
$city = City::factory()->create(['country_id' => $country->id]);
|
||||
Venue::factory()->create(['city_id' => $city->id]);
|
||||
Meetup::factory()->create(['city_id' => $city->id]);
|
||||
Lecturer::factory()->create();
|
||||
SelfHostedService::factory()->create();
|
||||
});
|
||||
|
||||
it('returns successful response for authenticated routes', function (string $path) {
|
||||
actingAsUser();
|
||||
$this->get($path)->assertSuccessful();
|
||||
})->with([
|
||||
'meetup create' => '/de/meetup-create',
|
||||
'course create' => '/de/course-create',
|
||||
'lecturer create' => '/de/lecturer-create',
|
||||
'city create' => '/de/city-create',
|
||||
'venue create' => '/de/venue-create',
|
||||
'service create' => '/de/service-create',
|
||||
'settings profile' => '/de/settings/profile',
|
||||
'settings password' => '/de/settings/password',
|
||||
'settings appearance' => '/de/settings/appearance',
|
||||
'verify email notice' => '/verify-email',
|
||||
'confirm password' => '/confirm-password',
|
||||
'dashboard' => '/de/dashboard',
|
||||
]);
|
||||
|
||||
it('redirects to login when guest accesses protected routes', function (string $path) {
|
||||
$this->get($path)->assertRedirect(route('login'));
|
||||
})->with([
|
||||
'meetup create' => '/de/meetup-create',
|
||||
'service create' => '/de/service-create',
|
||||
'settings profile' => '/de/settings/profile',
|
||||
]);
|
||||
|
||||
it('redirects /de/settings to /settings/profile (current behaviour drops the country prefix)', function () {
|
||||
actingAsUser();
|
||||
$this->get('/de/settings')->assertRedirect('/settings/profile');
|
||||
});
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
use App\Models\City;
|
||||
use App\Models\Country;
|
||||
use App\Models\Course;
|
||||
use App\Models\Lecturer;
|
||||
use App\Models\Meetup;
|
||||
use App\Models\MeetupEvent;
|
||||
use App\Models\SelfHostedService;
|
||||
use App\Models\Venue;
|
||||
|
||||
beforeEach(function () {
|
||||
$country = Country::factory()->create(['code' => 'de']);
|
||||
$city = City::factory()->create(['country_id' => $country->id]);
|
||||
Venue::factory()->create(['city_id' => $city->id]);
|
||||
$meetup = Meetup::factory()->create(['city_id' => $city->id]);
|
||||
MeetupEvent::factory()->create(['meetup_id' => $meetup->id]);
|
||||
Course::factory()->create();
|
||||
Lecturer::factory()->create();
|
||||
SelfHostedService::factory()->create();
|
||||
});
|
||||
|
||||
it('returns a successful response for the listed public route', function (string $path) {
|
||||
$this->get($path)->assertSuccessful();
|
||||
})->with([
|
||||
'welcome' => '/welcome',
|
||||
'login' => '/login',
|
||||
'register' => '/register',
|
||||
'forgot password' => '/forgot-password',
|
||||
'meetups index' => '/de/meetups',
|
||||
'meetups all' => '/de/all-meetups',
|
||||
'map' => '/de/map',
|
||||
'map world' => '/de/map-world',
|
||||
'courses index' => '/de/courses',
|
||||
'lecturers index' => '/de/lecturers',
|
||||
'cities index' => '/de/cities',
|
||||
'venues index' => '/de/venues',
|
||||
'services index' => '/de/services',
|
||||
]);
|
||||
|
||||
it('redirects / to /welcome', function () {
|
||||
$this->get('/')->assertRedirect('/welcome');
|
||||
});
|
||||
|
||||
it('redirects /de/dashboard to login when guest', function () {
|
||||
$this->get('/de/dashboard')->assertRedirect(route('login'));
|
||||
});
|
||||
|
||||
it('renders /kaninchenbau as a Livewire helper page', function () {
|
||||
$response = $this->get('/kaninchenbau');
|
||||
expect($response->status())->toBeIn([200, 302]);
|
||||
});
|
||||
|
||||
it('returns 404 for the application fallback route', function () {
|
||||
$this->get('/this-route-does-not-exist')->assertNotFound();
|
||||
});
|
||||
|
||||
it('aborts with the requested status code for /error/{code}', function () {
|
||||
$this->get('/error/418')->assertStatus(418);
|
||||
});
|
||||
Reference in New Issue
Block a user