mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-app.git
synced 2026-05-05 04:54:53 +00:00
🔥 **Cleanup & Tests:** Removed the obsolete auth.register component and its related route, feature tests, and browser tests. Disabled public registration and added tests to ensure /register returns a 404. Added new tests for service, lecturer, city, venue, and meetup CRUD flows.
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
use App\Models\City;
|
||||
use App\Models\Country;
|
||||
use App\Models\Meetup;
|
||||
|
||||
beforeEach(function () {
|
||||
$this->country = Country::factory()->create(['code' => 'de', 'name' => 'Deutschland']);
|
||||
$this->city = City::factory()->create([
|
||||
'country_id' => $this->country->id,
|
||||
'name' => 'BrowserMeetupTestCity',
|
||||
]);
|
||||
});
|
||||
|
||||
it('creates a new meetup end-to-end via the create form', function () {
|
||||
actingAsUser();
|
||||
$cityId = $this->city->id;
|
||||
|
||||
$page = visit('/de/meetup-create');
|
||||
|
||||
$page->fill('[wire\\:model="name"]', 'BrowserSeeded Meetup');
|
||||
$page->script("Livewire.getByName('meetups.create')[0].set('city_id', {$cityId})");
|
||||
$page->wait(0.5)
|
||||
->select('[wire\\:model="community"]', 'einundzwanzig');
|
||||
$page->script("Livewire.getByName('meetups.create')[0].call('createMeetup')");
|
||||
$page->wait(2)
|
||||
->assertNoJavaScriptErrors();
|
||||
|
||||
expect(Meetup::query()->where('name', 'BrowserSeeded Meetup')->exists())->toBeTrue();
|
||||
});
|
||||
|
||||
it('blocks meetup creation when the name is missing', function () {
|
||||
actingAsUser();
|
||||
$cityId = $this->city->id;
|
||||
|
||||
$page = visit('/de/meetup-create');
|
||||
|
||||
$page->script("Livewire.getByName('meetups.create')[0].set('city_id', {$cityId})");
|
||||
$page->wait(0.5)
|
||||
->select('[wire\\:model="community"]', 'einundzwanzig');
|
||||
$page->script("Livewire.getByName('meetups.create')[0].call('createMeetup')");
|
||||
$page->wait(1)
|
||||
->assertNoJavaScriptErrors();
|
||||
|
||||
expect(Meetup::query()->count())->toBe(0);
|
||||
});
|
||||
|
||||
it('blocks meetup creation when no city is selected', function () {
|
||||
actingAsUser();
|
||||
|
||||
$page = visit('/de/meetup-create');
|
||||
|
||||
$page->fill('[wire\\:model="name"]', 'NoCityMeetup')
|
||||
->select('[wire\\:model="community"]', 'einundzwanzig');
|
||||
$page->script("Livewire.getByName('meetups.create')[0].call('createMeetup')");
|
||||
$page->wait(1)
|
||||
->assertNoJavaScriptErrors();
|
||||
|
||||
expect(Meetup::query()->where('name', 'NoCityMeetup')->exists())->toBeFalse();
|
||||
});
|
||||
Reference in New Issue
Block a user