Move recordings UI to Livewire pages with Flux components.

Replace controller-driven Blade views with full-page Livewire index/show/create flows so Flux tables, toasts, and uploads work natively.
This commit is contained in:
ben
2026-08-12 19:17:52 +02:00
parent bfcfc12f58
commit 34ccf0c32b
37 changed files with 1482 additions and 1103 deletions
+22 -23
View File
@@ -3,12 +3,14 @@
namespace Tests\Feature;
use App\Jobs\TranscribeRecording;
use App\Livewire\UploadRecordings;
use App\Models\Recording;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Http\UploadedFile;
use Illuminate\Support\Facades\Bus;
use Illuminate\Support\Facades\Storage;
use Livewire\Livewire;
use Tests\TestCase;
class RecordingDuplicateUploadTest extends TestCase
@@ -33,19 +35,18 @@ class RecordingDuplicateUploadTest extends TestCase
$first = UploadedFile::fake()->createWithContent('meeting.mp3', 'identical-audio-bytes');
$duplicate = UploadedFile::fake()->createWithContent('meeting-copy.mp3', 'identical-audio-bytes');
$this->post(route('recordings.store'), [
'audio' => [$first],
])->assertRedirect();
Livewire::test(UploadRecordings::class)
->set('audio', [$first])
->assertRedirect();
$this->assertSame(1, Recording::query()->count());
Bus::assertDispatched(TranscribeRecording::class, 1);
$response = $this->post(route('recordings.store'), [
'audio' => [$duplicate],
]);
Livewire::test(UploadRecordings::class)
->set('audio', [$duplicate])
->assertRedirect(route('recordings.create'))
->assertSessionHas('error');
$response->assertRedirect(route('recordings.create'));
$response->assertSessionHas('error');
$this->assertSame(1, Recording::query()->count());
Bus::assertDispatched(TranscribeRecording::class, 1);
}
@@ -59,18 +60,17 @@ class RecordingDuplicateUploadTest extends TestCase
$two = UploadedFile::fake()->createWithContent('two.mp3', 'same-bytes');
$three = UploadedFile::fake()->createWithContent('three.mp3', 'different-bytes');
$response = $this->post(route('recordings.store'), [
'audio' => [$one, $two, $three],
]);
Livewire::test(UploadRecordings::class)
->set('audio', [$one, $two, $three])
->assertRedirect(route('recordings.index'))
->assertSessionHas('success');
$response->assertRedirect(route('recordings.index'));
$response->assertSessionHas('success');
$this->assertStringContainsString('Skipped 1 duplicate', session('success'));
$this->assertSame(2, Recording::query()->count());
Bus::assertDispatched(TranscribeRecording::class, 2);
}
public function test_upload_page_includes_existing_fingerprints_for_client_dedupe(): void
public function test_upload_page_mentions_duplicate_skipping(): void
{
Recording::query()->create([
'user_id' => $this->user->id,
@@ -84,7 +84,7 @@ class RecordingDuplicateUploadTest extends TestCase
$this->get(route('recordings.create'))
->assertOk()
->assertSee('note.mp3:2048', false)
->assertSeeLivewire('upload-recordings')
->assertSee('Duplicate files', false);
}
@@ -103,12 +103,11 @@ class RecordingDuplicateUploadTest extends TestCase
'transcription_status' => 'done',
]);
$response = $this->post(route('recordings.store'), [
'audio' => [UploadedFile::fake()->createWithContent('legacy.mp3', 'legacy-audio')],
]);
Livewire::test(UploadRecordings::class)
->set('audio', [UploadedFile::fake()->createWithContent('legacy.mp3', 'legacy-audio')])
->assertRedirect(route('recordings.create'))
->assertSessionHas('error');
$response->assertRedirect(route('recordings.create'));
$response->assertSessionHas('error');
$this->assertSame(1, Recording::query()->count());
Bus::assertNothingDispatched();
}
@@ -120,9 +119,9 @@ class RecordingDuplicateUploadTest extends TestCase
$file = UploadedFile::fake()->createWithContent('hash-me.mp3', 'payload-for-hash');
$this->post(route('recordings.store'), [
'audio' => [$file],
])->assertRedirect();
Livewire::test(UploadRecordings::class)
->set('audio', [$file])
->assertRedirect();
$recording = Recording::query()->first();
$this->assertNotNull($recording);