(t *testing.T)
| 1568 | } |
| 1569 | |
| 1570 | func Test_issueWriteHasNonFormParams(t *testing.T) { |
| 1571 | t.Parallel() |
| 1572 | |
| 1573 | tests := []struct { |
| 1574 | name string |
| 1575 | args map[string]any |
| 1576 | want bool |
| 1577 | }{ |
| 1578 | {name: "no params", args: map[string]any{}, want: false}, |
| 1579 | {name: "only form params", args: map[string]any{"method": "create", "owner": "o", "repo": "r", "title": "t", "body": "b", "issue_number": float64(1), "_ui_submitted": true}, want: false}, |
| 1580 | {name: "labels present", args: map[string]any{"title": "t", "labels": []any{"bug"}}, want: false}, |
| 1581 | {name: "assignees present", args: map[string]any{"title": "t", "assignees": []any{"octocat"}}, want: false}, |
| 1582 | {name: "milestone present", args: map[string]any{"title": "t", "milestone": float64(2)}, want: false}, |
| 1583 | {name: "type present", args: map[string]any{"title": "t", "type": "Bug"}, want: false}, |
| 1584 | {name: "issue_fields present", args: map[string]any{"issue_fields": []any{map[string]any{"field_name": "Priority"}}}, want: false}, |
| 1585 | {name: "state present", args: map[string]any{"state": "closed"}, want: false}, |
| 1586 | {name: "state_reason present", args: map[string]any{"state_reason": "completed"}, want: false}, |
| 1587 | {name: "duplicate_of present", args: map[string]any{"duplicate_of": float64(7)}, want: false}, |
| 1588 | {name: "unknown non-schema param present", args: map[string]any{"title": "t", "not_a_real_param": "x"}, want: true}, |
| 1589 | {name: "nil value is ignored", args: map[string]any{"issue_fields": nil}, want: false}, |
| 1590 | } |
| 1591 | |
| 1592 | for _, tc := range tests { |
| 1593 | t.Run(tc.name, func(t *testing.T) { |
| 1594 | t.Parallel() |
| 1595 | assert.Equal(t, tc.want, hasNonFormParams(tc.args, issueWriteFormParams)) |
| 1596 | }) |
| 1597 | } |
| 1598 | } |
| 1599 | |
| 1600 | // Test_issueWriteSchemaClassification fails when a schema property is added |
| 1601 | // without classifying it as either form-resendable (issueWriteFormParams) or |
nothing calls this directly
no test coverage detected