(t *testing.T)
| 169 | } |
| 170 | |
| 171 | func TestPlanSpecAdd_EmitsIssueComment(t *testing.T) { |
| 172 | t.Parallel() |
| 173 | a := require.New(t) |
| 174 | f := setupPlanUpdateFixture(t, true) |
| 175 | |
| 176 | originalSpec := f.plan.Specs[0] |
| 177 | newSpecID := uuid.NewString() |
| 178 | _, err := f.ctl.planServiceClient.UpdatePlan(f.ctx, connect.NewRequest(&v1pb.UpdatePlanRequest{ |
| 179 | Plan: &v1pb.Plan{ |
| 180 | Name: f.plan.Name, |
| 181 | Specs: []*v1pb.Plan_Spec{ |
| 182 | originalSpec, |
| 183 | { |
| 184 | Id: newSpecID, |
| 185 | Config: &v1pb.Plan_Spec_ChangeDatabaseConfig{ |
| 186 | ChangeDatabaseConfig: &v1pb.Plan_ChangeDatabaseConfig{ |
| 187 | Targets: []string{f.database.Name}, |
| 188 | Sheet: f.sheet2.Name, |
| 189 | }, |
| 190 | }, |
| 191 | }, |
| 192 | }, |
| 193 | }, |
| 194 | UpdateMask: &fieldmaskpb.FieldMask{Paths: []string{"specs"}}, |
| 195 | })) |
| 196 | a.NoError(err) |
| 197 | |
| 198 | events := listPlanUpdateEvents(t, f) |
| 199 | a.Len(events, 1) |
| 200 | ev := events[0] |
| 201 | a.Len(ev.FromSpecs, 1) |
| 202 | a.Len(ev.ToSpecs, 2) |
| 203 | a.Equal(originalSpec.Id, ev.FromSpecs[0].Id) |
| 204 | idsAfter := map[string]bool{} |
| 205 | for _, s := range ev.ToSpecs { |
| 206 | idsAfter[s.Id] = true |
| 207 | } |
| 208 | a.True(idsAfter[originalSpec.Id]) |
| 209 | a.True(idsAfter[newSpecID]) |
| 210 | } |
| 211 | |
| 212 | func TestPlanSpecRemove_EmitsIssueComment(t *testing.T) { |
| 213 | t.Parallel() |
nothing calls this directly
no test coverage detected