#Does inertia's test helper make an actual http request?
1 messages · Page 1 of 1 (latest)
Does inertia's test helper make an actual http request?
I have a global scope that filters models based on the auth()->user()?->tenant_id. It is applied via a trait. This works fine when tested manually.
The issue is, I have a test that asserts that data from other tenants is filtered out. When I apply the filter on the query manually in the controller, the test passes. I.e I add to the query
->when($tenantId = auth()->user()?->tenant_id, fn ($query) =>
$query->where('tenant_id', $tenantId)
)
What would be the correct way to test this functionality if the assertInertia method does not fetch the data from the controller via real http request?