Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how would you testing a delete route? #3

Open
wajeht opened this issue Mar 16, 2023 · 0 comments
Open

how would you testing a delete route? #3

wajeht opened this issue Mar 16, 2023 · 0 comments

Comments

@wajeht
Copy link

wajeht commented Mar 16, 2023

how can I test a delete route? I keep getting 200 responses.

beforeEach(function () {
    Post::factory(2)->create();
    $this->superAdmin = User::factory()->asSuperAdmin()->create();
    $this->user = User::factory()->create();
    $this->post = Post::all()->first();
});

// using spatie permission package
// returns 200 
it('should not be able to delete a post', function () {
    $this->actingAs($this->user)
        ->delete("/nova-api/posts?resources[]={$this->post->id}")
        ->assertForbidden();

    // dd($this->post) // still seeing this;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant