mirror of
https://github.com/cheveguerra/bot-whatsapp.git
synced 2026-04-18 11:39:15 +00:00
adapter provider
This commit is contained in:
@@ -35,11 +35,22 @@ test(`[BotClass]: recibe los mensajes entrantes del provider`, () => {
|
||||
provider: adapterProvider,
|
||||
})
|
||||
|
||||
bot.on('message', (ctx) => messages.push(ctx.body))
|
||||
bot.emit('message', { body: 'hola' })
|
||||
bot.emit('message', { body: 'otro' })
|
||||
bot.on('message', (ctx) => messages.push(ctx))
|
||||
bot.emit('message', 'hola')
|
||||
bot.emit('message', 'otro')
|
||||
|
||||
assert.is(messages.join(','), ['hola', 'otro'].join(','))
|
||||
const getHistoryFromDB = adapterDB.engineDB.listHistory
|
||||
|
||||
assert.is(messages.join(), ['hola', 'otro'].join())
|
||||
assert.is(
|
||||
getHistoryFromDB.join(),
|
||||
[
|
||||
'hola',
|
||||
'Bienvenido a tu tienda 🥲',
|
||||
'escribe *catalogo* o *ofertas*',
|
||||
'otro',
|
||||
].join()
|
||||
)
|
||||
})
|
||||
|
||||
test.run()
|
||||
|
||||
Reference in New Issue
Block a user