wilfredlepelaar
2 months ago
39
1
Nova

How to test Laravel Nova Api route policies | TDD

Posted 2 months ago by wilfredlepelaar

How can I test API route policies for Nova resources? When I run the following test I receive a 403 response. (without any policies set)

    $response = $this->json('POST', 'nova-api/users', [
        'name' => 'Fancy Name',
        'password' => 'secretpassword',
        'email' => '[email protected]'
    ]);

    $response
        ->assertStatus(200)
        ->assertJson([
            'created' => true,
        ]);

Please sign in or create an account to participate in this conversation.