mirror of
https://github.com/cheveguerra/bot-whatsapp.git
synced 2026-04-19 12:09:15 +00:00
test: a lot test
This commit is contained in:
22
__mocks__/env.js
Normal file
22
__mocks__/env.js
Normal file
@@ -0,0 +1,22 @@
|
||||
const MOCK_DB = require('../packages/database/src/mock')
|
||||
const PROVIDER_DB = require('../packages/provider/src/mock')
|
||||
|
||||
/**
|
||||
* Preparar env para el test
|
||||
* @param {*} context
|
||||
*/
|
||||
const setup = async (context) => {
|
||||
context.provider = new PROVIDER_DB()
|
||||
context.database = new MOCK_DB()
|
||||
}
|
||||
|
||||
const clear = async (context) => {
|
||||
context.provider = null
|
||||
context.database = null
|
||||
}
|
||||
|
||||
function delay(ms) {
|
||||
return new Promise((res) => setTimeout(res, ms))
|
||||
}
|
||||
|
||||
module.exports = { setup, clear, delay }
|
||||
Reference in New Issue
Block a user