ui overhaul
Some checks failed
Build and deploy Havenllo / Verify Go and frontend (push) Failing after 29s
Build and deploy Havenllo / Build and push image (push) Has been skipped
Build and deploy Havenllo / Apply and restart Havenllo (push) Has been skipped

This commit is contained in:
Hermes
2026-07-14 11:09:54 -03:00
parent 240f73b229
commit afd23ca751
19 changed files with 603 additions and 382 deletions

View File

@@ -84,3 +84,42 @@ func TestJSONValidationAndLastListConflict(t *testing.T) {
t.Fatalf("last list status = %d", got.Code)
}
}
func TestCardDoneFieldIsNotPartOfTheAPI(t *testing.T) {
t.Parallel()
handler := newHandler(t)
var board struct {
Lists []struct {
ID int64 `json:"id"`
} `json:"lists"`
}
if err := json.Unmarshal(request(t, handler, http.MethodGet, "/api/board", "", false).Body.Bytes(), &board); err != nil {
t.Fatal(err)
}
if len(board.Lists) == 0 {
t.Fatal("board has no lists")
}
created := request(t, handler, http.MethodPost, "/api/lists/"+strconv.FormatInt(board.Lists[0].ID, 10)+"/cards", `{"title":"status comes from the list"}`, true)
if created.Code != http.StatusCreated {
t.Fatalf("create card status = %d, body %s", created.Code, created.Body)
}
var payload struct {
Card map[string]json.RawMessage `json:"card"`
}
if err := json.Unmarshal(created.Body.Bytes(), &payload); err != nil {
t.Fatal(err)
}
if _, exists := payload.Card["done"]; exists {
t.Fatalf("card response unexpectedly contains done: %s", created.Body)
}
cardID := payload.Card["id"]
var id int64
if err := json.Unmarshal(cardID, &id); err != nil {
t.Fatal(err)
}
if got := request(t, handler, http.MethodPatch, "/api/cards/"+strconv.FormatInt(id, 10), `{"done":true}`, true); got.Code != http.StatusBadRequest {
t.Fatalf("done patch status = %d, body %s", got.Code, got.Body)
}
}