File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed
Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -205,6 +205,42 @@ describe('action', () => {
205205 } )
206206 } )
207207
208+ describe ( 'input repository is given' , ( ) => {
209+ describe ( 'valid format' , ( ) => {
210+ beforeEach ( ( ) => {
211+ jest . spyOn ( core , 'getInput' ) . mockImplementation ( ( name , _option ) => {
212+ if ( name == 'repository' ) return 'the-user/the-repo'
213+ return ''
214+ } )
215+ } )
216+
217+ it ( 'succeed' , async ( ) => {
218+ const setFailedMock = jest . spyOn ( core , 'setFailed' ) . mockReturnValue ( )
219+ await main . run ( )
220+ expect ( setFailedMock ) . toHaveBeenCalledWith (
221+ 'Neither files nor tag input has been configured'
222+ )
223+ } )
224+ } )
225+
226+ describe ( 'invalid format' , ( ) => {
227+ beforeEach ( ( ) => {
228+ jest . spyOn ( core , 'getInput' ) . mockImplementation ( ( name , _option ) => {
229+ if ( name == 'repository' ) return 'the-user-the-repo'
230+ return ''
231+ } )
232+ } )
233+
234+ it ( 'fails' , async ( ) => {
235+ const setFailedMock = jest . spyOn ( core , 'setFailed' ) . mockReturnValue ( )
236+ await main . run ( )
237+ expect ( setFailedMock ) . toHaveBeenCalledWith (
238+ 'Input <repository> "the-user-the-repo" is invalid'
239+ )
240+ } )
241+ } )
242+ } )
243+
208244 describe ( 'input branch is given' , ( ) => {
209245 beforeEach ( ( ) => {
210246 jest . spyOn ( core , 'getMultilineInput' ) . mockReturnValue ( [ '/test.txt' ] )
You can’t perform that action at this time.
0 commit comments