mirror of
https://github.com/cheveguerra/bot-whatsapp.git
synced 2026-04-17 19:26:23 +00:00
restore flow working!
This commit is contained in:
@@ -10,6 +10,7 @@ class MockFlow {
|
||||
class MockDB {
|
||||
listHistory = []
|
||||
save = () => {}
|
||||
getPrevByNumber = () => {}
|
||||
}
|
||||
|
||||
test(`[CoreClass] Probando instanciamiento de clase`, async () => {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
const { test } = require('uvu')
|
||||
const assert = require('uvu/assert')
|
||||
const { addKeyword, addAnswer } = require('@bot-whatsapp/bot')
|
||||
const { generateRefSerialize } = require('../utils/hash')
|
||||
const { addKeyword, addAnswer, toSerialize } = require('../io/methods')
|
||||
|
||||
test('Debere probar las propeidades', () => {
|
||||
const ARRANGE = {
|
||||
@@ -21,6 +22,26 @@ test('Debere probar las propeidades array', () => {
|
||||
assert.is(MAIN_CTX.ctx.keyword, ARRANGE.keyword)
|
||||
})
|
||||
|
||||
test('Debere probar toSerialize', () => {
|
||||
const ARRANGE = {
|
||||
keyword: ['hola!', 'ole'],
|
||||
}
|
||||
const MAIN_CTX = addKeyword(ARRANGE.keyword)
|
||||
.addAnswer('Segundo!')
|
||||
.addAnswer('Segundo!')
|
||||
.toJson()
|
||||
|
||||
const [ANSWER_A] = MAIN_CTX
|
||||
|
||||
assert.is(
|
||||
toSerialize(MAIN_CTX)[0].refSerialize,
|
||||
generateRefSerialize({
|
||||
index: 0,
|
||||
answer: ANSWER_A.answer,
|
||||
})
|
||||
)
|
||||
})
|
||||
|
||||
test('Debere probar el paso de contexto', () => {
|
||||
const ARRANGE = {
|
||||
keyword: 'hola!',
|
||||
|
||||
Reference in New Issue
Block a user