@@ -52,12 +52,13 @@ describe('Builds (e2e)', () => {
5252 } ;
5353 return requestWithApiKey ( app , 'post' , '/builds' , createBuildDto , user . apiKey )
5454 . expect ( 201 )
55- . expect ( res => {
55+ . expect ( ( res ) => {
5656 expect ( res . body . projectId ) . toBe ( project . id ) ;
5757 expect ( res . body . branchName ) . toBe ( createBuildDto . branchName ) ;
5858 expect ( res . body . failedCount ) . toBe ( 0 ) ;
5959 expect ( res . body . passedCount ) . toBe ( 0 ) ;
6060 expect ( res . body . unresolvedCount ) . toBe ( 0 ) ;
61+ expect ( res . body . isRunning ) . toBe ( true ) ;
6162 } ) ;
6263 } ) ;
6364
@@ -68,15 +69,16 @@ describe('Builds (e2e)', () => {
6869 } ;
6970 return requestWithApiKey ( app , 'post' , '/builds' , createBuildDto , user . apiKey )
7071 . expect ( 201 )
71- . expect ( res => {
72+ . expect ( ( res ) => {
7273 expect ( res . body . projectId ) . toBe ( project . id ) ;
7374 expect ( res . body . branchName ) . toBe ( createBuildDto . branchName ) ;
7475 expect ( res . body . failedCount ) . toBe ( 0 ) ;
7576 expect ( res . body . passedCount ) . toBe ( 0 ) ;
7677 expect ( res . body . unresolvedCount ) . toBe ( 0 ) ;
78+ expect ( res . body . isRunning ) . toBe ( true ) ;
7779 } ) ;
7880 } ) ;
79-
81+
8082 it ( '404' , ( ) => {
8183 const createBuildDto : CreateBuildDto = {
8284 branchName : 'branchName' ,
@@ -100,7 +102,7 @@ describe('Builds (e2e)', () => {
100102
101103 return requestWithAuth ( app , 'get' , `/builds?projectId=${ project . id } ` , { } , user . token )
102104 . expect ( 200 )
103- . expect ( res => {
105+ . expect ( ( res ) => {
104106 expect ( JSON . stringify ( res . body ) ) . toEqual ( JSON . stringify ( [ build ] ) ) ;
105107 } ) ;
106108 } ) ;
@@ -123,4 +125,23 @@ describe('Builds (e2e)', () => {
123125 return requestWithAuth ( app , 'delete' , `/builds/${ build . id } ` , { } , '' ) . expect ( 401 ) ;
124126 } ) ;
125127 } ) ;
128+
129+ describe ( 'PATCH /' , ( ) => {
130+ it ( '200' , async ( ) => {
131+ const build = await buildsService . create ( { project : project . id , branchName : 'develop' } ) ;
132+
133+ return requestWithApiKey ( app , 'patch' , `/builds/${ build . id } ` , { } , user . apiKey )
134+ . expect ( 200 )
135+ . expect ( ( res ) => {
136+ expect ( res . body . projectId ) . toBe ( project . id ) ;
137+ expect ( res . body . isRunning ) . toBe ( false ) ;
138+ } ) ;
139+ } ) ;
140+
141+ it ( '401' , async ( ) => {
142+ const build = await buildsService . create ( { project : project . id , branchName : 'develop' } ) ;
143+
144+ return requestWithAuth ( app , 'patch' , `/builds/${ build . id } ` , { } , '' ) . expect ( 401 ) ;
145+ } ) ;
146+ } ) ;
126147} ) ;
0 commit comments