import assert from 'assert'
import { ConverseTesting } from 'newbot/testing'
import mainSkill from './main'
describe('My own test', () => {
let converse, userConverse
beforeEach(() => {
converse = new ConverseTesting(mainSkill)
userConverse = converse.createUser()
})
test('Test Prompt', () => {
return userConverse
.start(testing => {
assert.equal(testing.output(0), 'Hello')
})
.prompt('Sam', testing => {
assert.equal(testing.output(0), 'Welcome Sam')
})
.end()
})
})
Note that the start() method performs all tests up to the input request. Then we use prompt() to enter a text (first parameter) and the scenario continues.
Perform a quick test of the conversation
It is possible to write a unit test more quickly if you want to test a simple conversation: