Skip to content

how would you testing a delete route? #3

@wajeht

Description

@wajeht

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;
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions