botfriends-handover-nodejs
Version:
NodeJs wrapper for BOTfriends Handover Tool
30 lines (28 loc) • 772 B
text/typescript
import { HandoverClient } from '../../src/lib/sdk'
import { assert } from 'chai'
const jwt = ''
const backendUrl = ''
describe('SDK', () => {
it('Client should throw an error when passing wrong params to sendMessage', async () => {
try {
const Client = new HandoverClient(jwt, backendUrl)
await Client.sendMessage('3999a3369d63b7482fbf52b7', {
role: 'bot'
})
} catch (err) {
assert.ok('Error thrown')
}
})
it('Client should send a message', async () => {
try {
const Client = new HandoverClient(jwt, backendUrl)
await Client.sendMessage('3999a3369d63b7482fbf52b7', {
role: 'bot',
source: 'web',
text: 'this is a text'
})
} catch (err) {
assert.fail()
}
})
})