2022-06-15 03:41:49 +02:00
|
|
|
import { PrepareJobArgs } from 'hooklib/lib'
|
2022-06-03 14:10:15 +02:00
|
|
|
import { cleanupJob, prepareJob } from '../src/hooks'
|
2022-06-02 15:53:11 -04:00
|
|
|
import TestSetup from './test-setup'
|
|
|
|
|
|
|
|
|
|
let testSetup: TestSetup
|
|
|
|
|
|
|
|
|
|
jest.useRealTimers()
|
|
|
|
|
|
|
|
|
|
describe('cleanup job', () => {
|
|
|
|
|
beforeEach(async () => {
|
|
|
|
|
testSetup = new TestSetup()
|
|
|
|
|
testSetup.initialize()
|
|
|
|
|
|
2022-06-15 03:41:49 +02:00
|
|
|
const prepareJobDefinition = testSetup.getPrepareJobDefinition()
|
2022-06-02 15:53:11 -04:00
|
|
|
|
2022-06-08 13:20:54 +02:00
|
|
|
const prepareJobOutput = testSetup.createOutputFile(
|
|
|
|
|
'prepare-job-output.json'
|
|
|
|
|
)
|
2022-06-03 14:10:15 +02:00
|
|
|
|
2022-06-15 03:41:49 +02:00
|
|
|
await prepareJob(
|
|
|
|
|
prepareJobDefinition.args as PrepareJobArgs,
|
|
|
|
|
prepareJobOutput
|
|
|
|
|
)
|
2022-06-02 15:53:11 -04:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
afterEach(() => {
|
|
|
|
|
testSetup.teardown()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('should cleanup successfully', async () => {
|
2022-06-03 16:01:24 +02:00
|
|
|
await expect(cleanupJob()).resolves.not.toThrow()
|
2022-06-02 15:53:11 -04:00
|
|
|
})
|
|
|
|
|
})
|