(t *testing.T)
| 211 | } |
| 212 | |
| 213 | func TestChange_SDL(t *testing.T) { |
| 214 | mock := newChangeMock(employeeDB()) |
| 215 | s := newChangeTestServer(t, mock) |
| 216 | |
| 217 | _, structured, err := s.handleChange(testContext(), nil, ChangeInput{ |
| 218 | Database: "employee_db", |
| 219 | SQL: "CREATE TABLE users (id INT PRIMARY KEY);", |
| 220 | Title: "SDL change", |
| 221 | ChangeType: "SDL", |
| 222 | }) |
| 223 | require.NoError(t, err) |
| 224 | |
| 225 | output, ok := structured.(*ChangeOutput) |
| 226 | require.True(t, ok) |
| 227 | // changeType is reflected in the response but not sent to the API |
| 228 | // (the backend auto-detects MIGRATE vs SDL from sheet content). |
| 229 | require.Equal(t, "SDL", output.ResolvedChangeType) |
| 230 | |
| 231 | // Verify plan spec does NOT include a type field (removed in migration 3.14). |
| 232 | plan := mock.getCapturedPlan() |
| 233 | planObj, ok := plan["plan"].(map[string]any) |
| 234 | require.True(t, ok) |
| 235 | specs, ok := planObj["specs"].([]any) |
| 236 | require.True(t, ok) |
| 237 | spec, ok := specs[0].(map[string]any) |
| 238 | require.True(t, ok) |
| 239 | cfg, ok := spec["changeDatabaseConfig"].(map[string]any) |
| 240 | require.True(t, ok) |
| 241 | _, hasType := cfg["type"] |
| 242 | require.False(t, hasType, "type field should not be sent to the API") |
| 243 | } |
| 244 | |
| 245 | func TestChange_ReasonIncluded(t *testing.T) { |
| 246 | mock := newChangeMock(employeeDB()) |
nothing calls this directly
no test coverage detected