testing-nova
testing-nova copied to clipboard
how would you testing a delete route?
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;
});