optimizations
This commit is contained in:
@@ -46,3 +46,22 @@ it('validates discovery event payload', function () {
|
||||
$response->assertStatus(422);
|
||||
$response->assertJsonValidationErrors(['event_type']);
|
||||
});
|
||||
|
||||
it('accepts session-oriented discovery events', function () {
|
||||
Queue::fake();
|
||||
|
||||
$user = User::factory()->create();
|
||||
$artwork = Artwork::factory()->create();
|
||||
|
||||
$response = $this->actingAs($user)->postJson('/api/discovery/events', [
|
||||
'event_type' => 'dwell',
|
||||
'artwork_id' => $artwork->id,
|
||||
'meta' => ['duration_ms' => 4500],
|
||||
]);
|
||||
|
||||
$response->assertStatus(202);
|
||||
|
||||
Queue::assertPushed(IngestUserDiscoveryEventJob::class, function (IngestUserDiscoveryEventJob $job): bool {
|
||||
return $job->eventType === 'dwell';
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user