user = User::factory()->create(); $this->actingAs($this->user); } public function test_dropping_files_saves_and_queues_transcription(): void { Storage::fake('local'); Bus::fake(); $file = UploadedFile::fake()->create('meeting.mp3', 500, 'audio/mpeg'); Livewire::test(UploadRecordings::class) ->set('audio', [$file]) ->assertRedirect(route('recordings.show', Recording::query()->first())); $recording = Recording::query()->first(); $this->assertNotNull($recording); $this->assertSame('meeting', $recording->title); $this->assertSame('pending', $recording->transcription_status); Storage::disk('local')->assertExists($recording->file_path); Bus::assertDispatched(TranscribeRecording::class); } public function test_batch_upload_redirects_to_index(): void { Storage::fake('local'); Bus::fake(); Livewire::test(UploadRecordings::class) ->set('audio', [ UploadedFile::fake()->createWithContent('one.mp3', str_repeat('a', 400)), UploadedFile::fake()->createWithContent('two.wav', str_repeat('b', 400)), ]) ->assertRedirect(route('recordings.index')); $this->assertSame(2, Recording::query()->count()); Bus::assertDispatched(TranscribeRecording::class, 2); } }