|
41 | 41 | ->latestStatus->toEqual(IncidentStatusEnum::identified); |
42 | 42 | }); |
43 | 43 |
|
| 44 | +it('transitions parent incident status to fixed when incident update status is fixed', function () { |
| 45 | + $incident = Incident::factory()->create([ |
| 46 | + 'status' => IncidentStatusEnum::investigating, |
| 47 | + ]); |
| 48 | + |
| 49 | + $data = CreateIncidentUpdateRequestData::from([ |
| 50 | + 'message' => 'This issue has been fixed.', |
| 51 | + 'status' => IncidentStatusEnum::fixed, |
| 52 | + ]); |
| 53 | + |
| 54 | + app(CreateUpdate::class)->handle($incident, $data); |
| 55 | + |
| 56 | + expect($incident->fresh()) |
| 57 | + ->status->toEqual(IncidentStatusEnum::fixed); |
| 58 | +}); |
| 59 | + |
| 60 | +it('does not change parent incident status when incident update status is not fixed', function () { |
| 61 | + $incident = Incident::factory()->create([ |
| 62 | + 'status' => IncidentStatusEnum::investigating, |
| 63 | + ]); |
| 64 | + |
| 65 | + $data = CreateIncidentUpdateRequestData::from([ |
| 66 | + 'message' => 'Still looking into this.', |
| 67 | + 'status' => IncidentStatusEnum::identified, |
| 68 | + ]); |
| 69 | + |
| 70 | + app(CreateUpdate::class)->handle($incident, $data); |
| 71 | + |
| 72 | + expect($incident->fresh()) |
| 73 | + ->status->toEqual(IncidentStatusEnum::investigating); |
| 74 | +}); |
| 75 | + |
44 | 76 | it('sets linked component status to operational when incident update status is fixed', function () { |
45 | 77 | $incident = Incident::factory()->create([ |
46 | 78 | 'status' => IncidentStatusEnum::investigating, |
|
0 commit comments