laravel-actions
laravel-actions copied to clipboard
Testing batched jobs
Hi,
I got an action which dispatches jobs (which are actions too, hurray). Looks like that:
$documents->each(fn($doc) => GenerateDocumentFiles::dispatch($doc));
and is tested nicely with that
ProcessMissionDeliverable::assertPushedOn('default', 2);
Moving to batches
I wanted to move to batches. So I did that :
$jobs = $documents->map(fn($doc) => GenerateDocumentFiles::makeJob($doc));
Bus::batch($jobs->toArray())->dispatch();
However now my test is failing and saying that no jobs have been dispatched.
Any advices on how to test that?