@@ -108,6 +108,38 @@ describe('setup-go', () => {
108108 ) ;
109109 } ) ;
110110
111+ it ( 'reports a failed download' , async ( ) => {
112+ let errMsg = 'unhandled download message' ;
113+ platSpy . mockImplementation ( ( ) => 'linux' ) ;
114+ archSpy . mockImplementation ( ( ) => 'x64' ) ;
115+
116+ inSpy . mockImplementation ( ( ) => '1.13.1' ) ;
117+ findSpy . mockImplementation ( ( ) => '' ) ;
118+ dlSpy . mockImplementation ( ( ) => {
119+ throw new Error ( errMsg ) ;
120+ } ) ;
121+ await run ( ) ;
122+
123+ expect ( cnSpy ) . toHaveBeenCalledWith (
124+ `::error::Failed to download version 1.13.1: Error: ${ errMsg } ${ os . EOL } `
125+ ) ;
126+ } ) ;
127+
128+ it ( 'reports empty query results' , async ( ) => {
129+ let errMsg = 'unhandled download message' ;
130+ platSpy . mockImplementation ( ( ) => 'linux' ) ;
131+ archSpy . mockImplementation ( ( ) => 'x64' ) ;
132+
133+ inSpy . mockImplementation ( ( ) => '1.13.1' ) ;
134+ findSpy . mockImplementation ( ( ) => '' ) ;
135+ getSpy . mockImplementation ( ( ) => null ) ;
136+ await run ( ) ;
137+
138+ expect ( cnSpy ) . toHaveBeenCalledWith (
139+ `::error::Failed to download version 1.13.1: Error: golang download url did not return results${ os . EOL } `
140+ ) ;
141+ } ) ;
142+
111143 it ( 'can query versions' , async ( ) => {
112144 let versions : im . IGoVersion [ ] | null = await im . getVersions (
113145 'https://non.existant.com/path'
0 commit comments