Skip to content

Commit

Permalink
test: add some more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
neekolas committed Aug 29, 2023
1 parent 94da658 commit 3cc16d8
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/conversations/JobRunner.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,23 @@ describe('JobRunner', () => {
const v3Runner = new JobRunner('v3', keystore)
expect(v3Runner.run(async () => {})).rejects.toThrow('unknown job type: v3')
})

it('returns the value from the callback', async () => {
const v1Runner = new JobRunner('v1', keystore)

const result = await v1Runner.run(async () => {
return 'foo'
})
expect(result).toBe('foo')
})

it('bubbles up errors from the callback', async () => {
const v1Runner = new JobRunner('v1', keystore)

await expect(
v1Runner.run(async () => {
throw new Error('foo')
})
).rejects.toThrow('foo')
})
})

0 comments on commit 3cc16d8

Please sign in to comment.