restore flow working!

This commit is contained in:
Leifer Mendez
2022-11-18 19:55:57 +01:00
parent e3664cc973
commit 6953c954a8
10 changed files with 101 additions and 27 deletions

View File

@@ -10,6 +10,7 @@ class MockFlow {
class MockDB {
listHistory = []
save = () => {}
getPrevByNumber = () => {}
}
test(`[CoreClass] Probando instanciamiento de clase`, async () => {

View File

@@ -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!',