mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
Port the unit tests from https://github.com/vercel/nft/tree/941be1cb3b9d38fbc99a8a6f07af568a64ed0f12/test/unit
31 lines
719 B
JavaScript
31 lines
719 B
JavaScript
const { BULL_REDIS_CONNECTION } = process.env
|
|
|
|
if (!BULL_REDIS_CONNECTION) {
|
|
console.log('Skipping bullmq integration test')
|
|
console.log(
|
|
'Create cache on redislabs.com and export BULL_REDIS_CONNECTION="redis://:password@hostname:port"'
|
|
)
|
|
return
|
|
}
|
|
|
|
const url = new URL(BULL_REDIS_CONNECTION)
|
|
const connection = {
|
|
username: url.username,
|
|
password: url.password,
|
|
host: url.hostname,
|
|
port: Number(url.port),
|
|
}
|
|
|
|
const { Queue } = require('bullmq')
|
|
|
|
async function main() {
|
|
const queue = new Queue('foo', { connection })
|
|
await queue.add('job', { id: 'one' })
|
|
await queue.add('job', { id: 'two' })
|
|
await queue.close()
|
|
}
|
|
|
|
main()
|
|
.then(() => console.log('bullmq success'))
|
|
.catch(console.error)
|