Test the actions

Here is an action

@Action('menu') 
start() {
    > Menu :action
}

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 Action', () => {
        return userConverse
            .action('menu', 'food', testing => {
                assert.equal(testing.output(0), 'Menu food')
            })
            .end()
    })
})

Use the action() method to execute an action in the script

We can ignore the second parameter if we do not use the magic variable :action:

userConverse.action('menu', testing => { })

Last updated