@@ -11,6 +11,7 @@ describe('Workflows API', () => {
1111 const id = 2 ;
1212 const projectId = 4 ;
1313 const stringId = 123 ;
14+ const languageId = 'uk' ;
1415
1516 const limit = 25 ;
1617
@@ -89,6 +90,46 @@ describe('Workflows API', () => {
8990 data : {
9091 id : id ,
9192 } ,
93+ } )
94+ . get ( `/projects/${ projectId } /workflow-steps/${ id } /languages/${ languageId } /status` , undefined , {
95+ reqheaders : {
96+ Authorization : `Bearer ${ api . token } ` ,
97+ } ,
98+ } )
99+ . reply ( 200 , {
100+ data : [
101+ {
102+ data : {
103+ stringId : stringId ,
104+ languageId : languageId ,
105+ stepId : id ,
106+ status : 'DONE' ,
107+ output : 'translated' ,
108+ } ,
109+ } ,
110+ ] ,
111+ pagination : {
112+ offset : 0 ,
113+ limit : limit ,
114+ } ,
115+ } )
116+ . patch ( `/projects/${ projectId } /workflow-steps/${ id } /languages/${ languageId } /status` , undefined , {
117+ reqheaders : {
118+ Authorization : `Bearer ${ api . token } ` ,
119+ } ,
120+ } )
121+ . reply ( 200 , {
122+ data : [
123+ {
124+ data : {
125+ stringId : stringId ,
126+ languageId : languageId ,
127+ stepId : id ,
128+ status : 'DONE' ,
129+ output : 'approved' ,
130+ } ,
131+ } ,
132+ ] ,
92133 } ) ;
93134 } ) ;
94135
@@ -126,4 +167,32 @@ describe('Workflows API', () => {
126167 const workflow = await api . getWorkflowTemplateInfo ( id ) ;
127168 expect ( workflow . data . id ) . toBe ( id ) ;
128169 } ) ;
170+
171+ it ( 'Get Workflow Step String Status' , async ( ) => {
172+ const stringStatuses = await api . getWorkflowStepStringStatus ( projectId , id , languageId ) ;
173+ expect ( stringStatuses . data . length ) . toBe ( 1 ) ;
174+ expect ( stringStatuses . data [ 0 ] . data . stringId ) . toBe ( stringId ) ;
175+ expect ( stringStatuses . data [ 0 ] . data . languageId ) . toBe ( languageId ) ;
176+ expect ( stringStatuses . data [ 0 ] . data . stepId ) . toBe ( id ) ;
177+ expect ( stringStatuses . data [ 0 ] . data . status ) . toBe ( 'DONE' ) ;
178+ expect ( stringStatuses . data [ 0 ] . data . output ) . toBe ( 'translated' ) ;
179+ expect ( stringStatuses . pagination . limit ) . toBe ( limit ) ;
180+ } ) ;
181+
182+ it ( 'Update Workflow Step String Status' , async ( ) => {
183+ const request = [
184+ {
185+ op : 'replace' as const ,
186+ path : `/${ stringId } /output` ,
187+ value : 'approved' ,
188+ } ,
189+ ] ;
190+ const result = await api . updateWorkflowStepStringStatus ( projectId , id , languageId , request ) ;
191+ expect ( result . data . length ) . toBe ( 1 ) ;
192+ expect ( result . data [ 0 ] . data . stringId ) . toBe ( stringId ) ;
193+ expect ( result . data [ 0 ] . data . languageId ) . toBe ( languageId ) ;
194+ expect ( result . data [ 0 ] . data . stepId ) . toBe ( id ) ;
195+ expect ( result . data [ 0 ] . data . status ) . toBe ( 'DONE' ) ;
196+ expect ( result . data [ 0 ] . data . output ) . toBe ( 'approved' ) ;
197+ } ) ;
129198} ) ;
0 commit comments