mirror of
https://github.com/actions/container-toolkit-action.git
synced 2025-12-11 04:32:49 +00:00
Add mock implementations
This commit is contained in:
@@ -11,10 +11,10 @@ import * as main from '../src/main'
|
|||||||
|
|
||||||
// Mock the GitHub Actions core library
|
// Mock the GitHub Actions core library
|
||||||
//const debugMock = jest.spyOn(core, 'debug')
|
//const debugMock = jest.spyOn(core, 'debug')
|
||||||
const infoMock = jest.spyOn(core, 'info')
|
const infoMock = jest.spyOn(core, 'info').mockImplementation()
|
||||||
const getInputMock = jest.spyOn(core, 'getInput')
|
const getInputMock = jest.spyOn(core, 'getInput').mockImplementation()
|
||||||
const setFailedMock = jest.spyOn(core, 'setFailed')
|
const setFailedMock = jest.spyOn(core, 'setFailed').mockImplementation()
|
||||||
const setOutputMock = jest.spyOn(core, 'setOutput')
|
const setOutputMock = jest.spyOn(core, 'setOutput').mockImplementation()
|
||||||
|
|
||||||
// Mock the action's main function
|
// Mock the action's main function
|
||||||
const runMock = jest.spyOn(main, 'run')
|
const runMock = jest.spyOn(main, 'run')
|
||||||
@@ -57,16 +57,12 @@ describe('action', () => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
try {
|
await main.run()
|
||||||
await main.run()
|
|
||||||
|
|
||||||
expect(runMock).toHaveReturned()
|
expect(runMock).toHaveReturned()
|
||||||
expect(setFailedMock).toHaveBeenNthCalledWith(
|
expect(setFailedMock).toHaveBeenNthCalledWith(
|
||||||
1,
|
1,
|
||||||
'milliseconds not a number'
|
'milliseconds not a number'
|
||||||
)
|
)
|
||||||
} catch (error) {
|
|
||||||
console.log(error)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user