Test the events
Here is an event
@Event('on', 'myevent')
start() {
> Hello :event
}
The test :
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 Event', () => {
return userConverse
.event('myevent', 'sam', testing => {
assert.equal(testing.output(0), 'Hello sam')
})
.end()
})
})
Let's use the event()
method to run an event in the script
We can ignore the second parameter if we do not use the magic variable
:event
:
userConverse.event('myevent', testing => { })
Last updated
Was this helpful?