(t *testing.T)
| 823 | } |
| 824 | |
| 825 | func TestChange_ReasonTruncation(t *testing.T) { |
| 826 | mock := newChangeMock(employeeDB()) |
| 827 | s := newChangeTestServer(t, mock) |
| 828 | |
| 829 | longReason := strings.Repeat("x", 2000) |
| 830 | result, _, err := s.handleChange(testContext(), nil, ChangeInput{ |
| 831 | Database: "employee_db", |
| 832 | SQL: "ALTER TABLE x ADD COLUMN y INT", |
| 833 | Title: "Test", |
| 834 | Reason: longReason, |
| 835 | }) |
| 836 | require.NoError(t, err) |
| 837 | require.False(t, result.IsError) |
| 838 | |
| 839 | text := result.Content[0].(*mcpsdk.TextContent).Text |
| 840 | require.Contains(t, text, "reason truncated to 1000 chars") |
| 841 | |
| 842 | // Issue description should be truncated. |
| 843 | issue := mock.getCapturedIssue() |
| 844 | issueObj, ok := issue["issue"].(map[string]any) |
| 845 | require.True(t, ok) |
| 846 | desc, ok := issueObj["description"].(string) |
| 847 | require.True(t, ok) |
| 848 | require.Len(t, desc, 1000) // 997 chars + "..." |
| 849 | } |
| 850 | |
| 851 | // --- Partial failure tests --- |
| 852 |
nothing calls this directly
no test coverage detected