@@ -77,6 +77,7 @@ describe('action', () => {
7777 expect ( core . setFailed ) . toHaveBeenLastCalledWith (
7878 'Input required and not supplied: message'
7979 ) ;
80+ expect ( core . setOutput ) . not . toHaveBeenCalled ( ) ;
8081 } ) ;
8182
8283 it ( 'requires the token input' , async ( ) => {
@@ -89,6 +90,7 @@ describe('action', () => {
8990 expect ( core . setFailed ) . toHaveBeenLastCalledWith (
9091 'Input required and not supplied: token'
9192 ) ;
93+ expect ( core . setOutput ) . not . toHaveBeenCalled ( ) ;
9294 } ) ;
9395
9496 it ( 'defaults to HEAD ref' , async ( ) => {
@@ -129,8 +131,9 @@ describe('action', () => {
129131 } )
130132 ) ;
131133
132- expect ( core . setOutput ) . toHaveBeenCalledTimes ( 1 ) ;
133- expect ( core . setOutput ) . toHaveBeenLastCalledWith ( 'sha' , commitSha ) ;
134+ expect ( core . setOutput ) . toHaveBeenCalledTimes ( 2 ) ;
135+ expect ( core . setOutput ) . toHaveBeenCalledWith ( 'ref-operation' , 'updated' ) ;
136+ expect ( core . setOutput ) . toHaveBeenCalledWith ( 'sha' , commitSha ) ;
134137 } ) ;
135138
136139 it ( 'uses user-supplied ref' , async ( ) => {
@@ -170,8 +173,9 @@ describe('action', () => {
170173 } )
171174 ) ;
172175
173- expect ( core . setOutput ) . toHaveBeenCalledTimes ( 1 ) ;
174- expect ( core . setOutput ) . toHaveBeenLastCalledWith ( 'sha' , commitSha ) ;
176+ expect ( core . setOutput ) . toHaveBeenCalledTimes ( 2 ) ;
177+ expect ( core . setOutput ) . toHaveBeenCalledWith ( 'ref-operation' , 'updated' ) ;
178+ expect ( core . setOutput ) . toHaveBeenCalledWith ( 'sha' , commitSha ) ;
175179 } ) ;
176180
177181 it ( 'updates existing ref' , async ( ) => {
@@ -193,6 +197,10 @@ describe('action', () => {
193197 expect ( lib . getHeadRef ) . toHaveBeenCalled ( ) ;
194198 expect ( updateRef ) . toHaveBeenCalled ( ) ;
195199 expect ( createRef ) . not . toHaveBeenCalled ( ) ;
200+
201+ expect ( core . setOutput ) . toHaveBeenCalledTimes ( 2 ) ;
202+ expect ( core . setOutput ) . toHaveBeenCalledWith ( 'ref-operation' , 'updated' ) ;
203+ expect ( core . setOutput ) . toHaveBeenCalledWith ( 'sha' , commitSha ) ;
196204 } ) ;
197205
198206 it ( 'creates new ref' , async ( ) => {
@@ -232,6 +240,10 @@ describe('action', () => {
232240 ref : `refs/heads/${ ref } `
233241 } )
234242 ) ;
243+
244+ expect ( core . setOutput ) . toHaveBeenCalledTimes ( 2 ) ;
245+ expect ( core . setOutput ) . toHaveBeenCalledWith ( 'ref-operation' , 'created' ) ;
246+ expect ( core . setOutput ) . toHaveBeenCalledWith ( 'sha' , commitSha ) ;
235247 } ) ;
236248
237249 it ( 'rethrows other errors on updateRef' , async ( ) => {
@@ -256,6 +268,7 @@ describe('action', () => {
256268
257269 expect ( core . setFailed ) . toHaveBeenCalledTimes ( 1 ) ;
258270 expect ( core . setFailed ) . toHaveBeenLastCalledWith ( 'Server error' ) ;
271+ expect ( core . setOutput ) . not . toHaveBeenCalled ( ) ;
259272 } ) ;
260273
261274 it ( 'errors if no changes to commit' , async ( ) => {
@@ -270,6 +283,7 @@ describe('action', () => {
270283 expect ( core . setFailed ) . toHaveBeenLastCalledWith (
271284 'No changes found to commit'
272285 ) ;
286+ expect ( core . setOutput ) . not . toHaveBeenCalled ( ) ;
273287 } ) ;
274288
275289 it ( 'does not error if fail-on-no-changes is false' , async ( ) => {
@@ -285,6 +299,7 @@ describe('action', () => {
285299 expect ( core . notice ) . toHaveBeenLastCalledWith (
286300 'No changes found to commit - skipping'
287301 ) ;
302+ expect ( core . setOutput ) . not . toHaveBeenCalled ( ) ;
288303 } ) ;
289304
290305 it ( 'can force an update' , async ( ) => {
@@ -311,6 +326,10 @@ describe('action', () => {
311326 } )
312327 ) ;
313328 expect ( createRef ) . not . toHaveBeenCalled ( ) ;
329+
330+ expect ( core . setOutput ) . toHaveBeenCalledTimes ( 2 ) ;
331+ expect ( core . setOutput ) . toHaveBeenCalledWith ( 'ref-operation' , 'updated' ) ;
332+ expect ( core . setOutput ) . toHaveBeenCalledWith ( 'sha' , commitSha ) ;
314333 } ) ;
315334
316335 it ( 'handles generic errors' , async ( ) => {
@@ -324,6 +343,7 @@ describe('action', () => {
324343
325344 expect ( core . setFailed ) . toHaveBeenCalledTimes ( 1 ) ;
326345 expect ( core . setFailed ) . toHaveBeenLastCalledWith ( 'Server error' ) ;
346+ expect ( core . setOutput ) . not . toHaveBeenCalled ( ) ;
327347 } ) ;
328348
329349 it ( 'stringifies non-errors' , async ( ) => {
@@ -337,6 +357,7 @@ describe('action', () => {
337357
338358 expect ( core . setFailed ) . toHaveBeenCalledTimes ( 1 ) ;
339359 expect ( core . setFailed ) . toHaveBeenLastCalledWith ( '42' ) ;
360+ expect ( core . setOutput ) . not . toHaveBeenCalled ( ) ;
340361 } ) ;
341362} ) ;
342363
0 commit comments