Skip to content
This repository has been archived by the owner on Mar 3, 2021. It is now read-only.

Adds support for count test #10

Merged
merged 1 commit into from Nov 30, 2020
Merged

Adds support for count test #10

merged 1 commit into from Nov 30, 2020

Conversation

hotmeteor
Copy link
Contributor

@hotmeteor hotmeteor commented Nov 29, 2020

This PR adds support for a ->assertInertiaCount($key, $count) test method.

Often you want to be able to test that the correct data is being returned to the browser based on filtering criteria. This new method functions like the others with a simple key / comparison signature.

// Base

$this->get(route('locations.index'))
    ->assertInertia('Locations/Index')
    ->assertInertiaHas('locations')
    ->assertInertiaCount('locations', 5);

// Filtered

$query = http_build_query(['province' => 'ON']);

$this->get(route('locations.index')."?{$query}")
    ->assertInertia('Locations/Index')
    ->assertInertiaHas('locations')
    ->assertInertiaCount('locations', 2);

@claudiodekker claudiodekker merged commit ff97339 into claudiodekker:master Nov 30, 2020
@claudiodekker
Copy link
Owner

Nice one Adam! 👍

@hotmeteor hotmeteor deleted the assert-count branch November 30, 2020 13:48
@hotmeteor
Copy link
Contributor Author

Sorry, just realized I should have included documentation update. Want me to do that quick?

@claudiodekker
Copy link
Owner

claudiodekker commented Nov 30, 2020

That'd be great, otherwise I can pick it up later, no worries :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants