MCPcopy Create free account
hub / github.com/PerpetualSoftware/pad / commentKeyFixture

Function commentKeyFixture

internal/server/task3585_comment_key_test.go:12–23  ·  view source on GitHub ↗

TASK-3585: idempotency keys on comment create.

(t *testing.T)

Source from the content-addressed store, hash-verified

10
11// TASK-3585: idempotency keys on comment create.
12func commentKeyFixture(t *testing.T) (*Server, string) {
13 t.Helper()
14 srv := testServer(t)
15 slug := createWSWithCollections(t, srv)
16 rr := doRequest(srv, "POST", "/api/v1/workspaces/"+slug+"/collections/tasks/items", map[string]any{"title": "Commented on", "fields": `{"status":"open"}`})
17 if rr.Code != http.StatusCreated {
18 t.Fatalf("item: %d %s", rr.Code, rr.Body.String())
19 }
20 var it models.Item
21 _ = json.Unmarshal(rr.Body.Bytes(), &it)
22 return srv, "/api/v1/workspaces/" + slug + "/items/" + it.Slug + "/comments"
23}
24
25func countComments(t *testing.T, srv *Server, path, body string) int {
26 t.Helper()

Calls 6

testServerFunction · 0.85
createWSWithCollectionsFunction · 0.85
doRequestFunction · 0.85
HelperMethod · 0.80
FatalfMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected