-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadapter.integration.test.ts
52 lines (47 loc) · 1.2 KB
/
adapter.integration.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import { suite } from './test/suite.ts'
import bullmq from './mod.ts'
Deno.test({
name: 'BullMQ Adapter Test Suite - Integration',
fn: async (t) => {
const url = Deno.env.get('REDIS_URL')
if (!url) {
throw new Error('Redis connection string is required at REDIS_URL')
}
const JOB = { type: 'FOOBAR', payload: { id: 1 } }
/**
* Load configuration
*/
const {
redis,
createQueue,
createWorker,
concurrency,
failedTtl,
keyPrefix,
} = await bullmq({ url, options: { keyPrefix: 'integration' } }).load()
/**
* Execute the test suite, injecting our configuration
*/
await suite(t, { target: 'http://localhost:3000/hooks/jobs', job: JOB })({
redis,
/**
* Mock fetch in the test suite
*/
fetch: undefined,
createQueue,
createWorker,
concurrency,
failedTtl,
keyPrefix,
}, { shouldBaseLine: true })
},
/**
* We ignore sanitization of resources
* and ops, when running integration tests,
* so connections can be lazily destroyed
*
* See https://deno.com/manual/basics/testing/sanitizers
*/
sanitizeOps: false,
sanitizeResources: false,
})