Skip to content

Commit

Permalink
test(api): delete video
Browse files Browse the repository at this point in the history
  • Loading branch information
sundowndev committed Sep 2, 2020
1 parent dbf44e7 commit b6ce2ab
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions api/v1/videos_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,18 @@ func TestApi(t *testing.T) {
assert.Equal(res.Result().StatusCode, 200, "should be equal")
assert.JSONEq("{\"code\": 200}", string(body))
})

t.Run("should return error on invalid uid", func(t *testing.T) {
db.Client = enttest.Open(t, "sqlite3", "file:ent?mode=memory&cache=shared&_fk=1")
defer db.Client.Close()

res, err := performRequest(r, "DELETE", "/v1/videos/uuid")
assert.Equal(nil, err, "should be equal")

body, _ := ioutil.ReadAll(res.Body)

assert.Equal(res.Result().StatusCode, 400, "should be equal")
assert.JSONEq("{\"code\": 400, \"message\":\"invalid UUID provided\"}", string(body))
})
})
}

0 comments on commit b6ce2ab

Please sign in to comment.