func TestDeleteTask(t *testing.T) { task.Delete("2") if len(testdb.Tsks) != 2 { t.Error("Task was no removed") } for _, tsk := range testdb.Tsks { if tsk.ID == "2" { t.Error("Removed wrong task") } } }
// deleteTask removes task for given ID func deleteTask(rw http.ResponseWriter, req *http.Request, p httprouter.Params) { task.Delete(p.ByName("id")) rw.WriteHeader(http.StatusOK) }