MCPcopy Create free account
hub / github.com/compozy/agh / TestUpdateTaskRequestHasChanges

Function TestUpdateTaskRequestHasChanges

internal/api/contract/contract_test.go:991–1033  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

989}
990
991func TestUpdateTaskRequestHasChanges(t *testing.T) {
992 t.Parallel()
993
994 title := "updated"
995 channel := "builders"
996 owner := &taskpkg.Ownership{Kind: taskpkg.OwnerKindPool, Ref: "reviewers"}
997 metadata := json.RawMessage(`{"priority":"high"}`)
998
999 testCases := []struct {
1000 name string
1001 req contract.UpdateTaskRequest
1002 want bool
1003 }{
1004 {name: "Should return false when no task changes are set", req: contract.UpdateTaskRequest{}, want: false},
1005 {name: "Should return true when title is set", req: contract.UpdateTaskRequest{Title: &title}, want: true},
1006 {
1007 name: "Should return true when network channel is set",
1008 req: contract.UpdateTaskRequest{NetworkChannel: &channel},
1009 want: true,
1010 },
1011 {name: "Should return true when owner is set", req: contract.UpdateTaskRequest{Owner: owner}, want: true},
1012 {
1013 name: "Should return true when metadata is set",
1014 req: contract.UpdateTaskRequest{Metadata: &metadata},
1015 want: true,
1016 },
1017 {
1018 name: "Should return true when clear owner is set",
1019 req: contract.UpdateTaskRequest{ClearOwner: true},
1020 want: true,
1021 },
1022 }
1023
1024 for _, tc := range testCases {
1025 t.Run(tc.name, func(t *testing.T) {
1026 t.Parallel()
1027
1028 if got := tc.req.HasChanges(); got != tc.want {
1029 t.Fatalf("UpdateTaskRequest.HasChanges() = %v, want %v", got, tc.want)
1030 }
1031 })
1032 }
1033}
1034
1035func TestNetworkPeerPayloadJSONShape(t *testing.T) {
1036 t.Parallel()

Callers

nothing calls this directly

Calls 2

RunMethod · 0.65
HasChangesMethod · 0.45

Tested by

no test coverage detected