File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -153,6 +153,27 @@ describe('dependency cache', () => {
153153 return expect ( save ( 'ant' ) ) . rejects . toThrowError ( 'unknown package manager specified: ant' ) ;
154154 } ) ;
155155
156+ it ( 'save with -1 cacheId , should not fail workflow' , async ( ) => {
157+ spyCacheSave . mockImplementation ( ( ) => Promise . resolve ( - 1 ) ) ;
158+ createStateForMissingBuildFile ( ) ;
159+
160+ await save ( 'maven' ) ;
161+ expect ( spyCacheSave ) . toBeCalled ( ) ;
162+ expect ( spyWarning ) . not . toBeCalled ( ) ;
163+ expect ( spyInfo ) . toBeCalled ( ) ;
164+ expect ( spyInfo ) . toBeCalledWith ( expect . stringMatching ( / ^ C a c h e s a v e d w i t h t h e k e y : .* / ) ) ;
165+ } ) ;
166+
167+ it ( 'saves with error from toolkit, should fail workflow' , async ( ) => {
168+ spyCacheSave . mockImplementation ( ( ) =>
169+ Promise . reject ( new cache . ValidationError ( 'Validation failed' ) )
170+ ) ;
171+ createStateForMissingBuildFile ( ) ;
172+
173+ expect . assertions ( 1 ) ;
174+ await expect ( save ( 'maven' ) ) . rejects . toEqual ( new cache . ValidationError ( 'Validation failed' ) ) ;
175+ } ) ;
176+
156177 describe ( 'for maven' , ( ) => {
157178 it ( 'uploads cache even if no pom.xml found' , async ( ) => {
158179 createStateForMissingBuildFile ( ) ;
You can’t perform that action at this time.
0 commit comments