Skip to content

Testing the value of a prop #227

@Livijn

Description

@Livijn

First off, I've looked through a couple of PRs that tried to ease the use of testing with Inertia. I'm not sure why you chose the "unorthodox" way that you did. The testing that exists in Laravel doesn't use closures like this, which is why it feels strange.

$response->assertInertia(function (Assert $page) {
    $page->component('Ads');
    $page->hasAll(['foo', 'bar']);
});

// vs

$response->assertInertiaComponent('Ads');
$response->assertInertiaHasProps(['foo', 'bar']);

So, now to my question. How do I test that a prop is equal to a value?

Based of the name I thought $page->has('foo', ['some', 'array']); would work, but it seems the has() method only allows integers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions