Skip to content

Commit

Permalink
Maybe test migtrations are actually called? :D
Browse files Browse the repository at this point in the history
  • Loading branch information
Sleavely committed May 12, 2020
1 parent 655a9d5 commit c88f2a2
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,20 @@ describe('run()', () => {
expect(migrations.getPendingJobs).toHaveBeenCalled()
})

it('passes pending jobs off to up()', async () => {
config.getConfig.mockResolvedValueOnce({})
const job = {
title: 'something non-descript',
responsibilities: 'all of them',
salary: 'too low',
}
migrations.getPendingJobs.mockResolvedValueOnce([job])

await main.run().catch(() => {})

expect(migrations.up).toHaveBeenCalledWith(job)
})

it('runs beforeAll hook before executing any migrations', async () => {
const beforeAll = jest.fn(() => Date.now())
config.getConfig.mockResolvedValueOnce({ beforeAll })
Expand Down

0 comments on commit c88f2a2

Please sign in to comment.