@@ -80,14 +80,61 @@ describe('Incident Tests', () => {
8080 } ) ;
8181 } ) ;
8282 } ) ;
83-
84- it ( 'should update an incident provided an existing incident ID' , done => {
83+ it ( 'should update an incident when someone gets assigned to the incident' , done => {
84+ sendRequest ( 'post' , incidentsEndpoint , testIncident , ( err , res ) => {
85+ const { id } = res . body . data ;
86+ const updateIncidentUrl = '/api/incidents/' + id ;
87+ sendRequest (
88+ 'put' ,
89+ updateIncidentUrl ,
90+ {
91+ ...testIncident ,
92+ assignee : {
93+ userId : 'cjl6egyei00005dnytqp4a06l' ,
94+ incidentId : id ,
95+ } ,
96+ } ,
97+ ( error , response ) => {
98+ expect ( response . body . status ) . toEqual ( 'success' ) ;
99+ done ( ) ;
100+ }
101+ ) ;
102+ } ) ;
103+ } ) ;
104+ it ( 'should update an incident when someone gets ccd to the incident' , done => {
105+ sendRequest ( 'post' , incidentsEndpoint , testIncident , ( err , res ) => {
106+ const { id } = res . body . data ;
107+ const updateIncidentUrl = '/api/incidents/' + id ;
108+ sendRequest (
109+ 'put' ,
110+ updateIncidentUrl ,
111+ {
112+ ...testIncident ,
113+ ccd : [
114+ {
115+ userId : 'cjl6fecrb11115vf09xly2f65' ,
116+ incidentId : id ,
117+ } ,
118+ ] ,
119+ } ,
120+ ( error , response ) => {
121+ expect ( response . body . status ) . toEqual ( 'success' ) ;
122+ done ( ) ;
123+ }
124+ ) ;
125+ } ) ;
126+ } ) ;
127+ it ( 'should update an incident when the status is updated' , done => {
85128 sendRequest ( 'post' , incidentsEndpoint , testIncident , ( err , res ) => {
86- const updateIncidentUrl = '/api/incidents/' + res . body . data . id ;
129+ const { id } = res . body . data ;
130+ const updateIncidentUrl = '/api/incidents/' + id ;
87131 sendRequest (
88132 'put' ,
89133 updateIncidentUrl ,
90- { ...testIncident , statusId : 3 } ,
134+ {
135+ ...testIncident ,
136+ statusId : 3 ,
137+ } ,
91138 ( error , response ) => {
92139 expect ( response . body . data . statusId ) . toEqual ( 3 ) ;
93140 done ( ) ;
@@ -96,10 +143,9 @@ describe('Incident Tests', () => {
96143 } ) ;
97144 } ) ;
98145
99- it ( 'should update an incident when someone gets assigned to it' , done => {
146+ it ( 'should update an incident when someone gets ccd to it' , done => {
100147 makeServerCall ( assigneeRequestBody , done , 'put' ) ;
101148 } ) ;
102-
103149 it ( 'should update an incident when someone gets ccd to it' , done => {
104150 makeServerCall ( ccdRequestBody , done , 'put' ) ;
105151 } ) ;
0 commit comments