2019-03-01 13:46:30 +03:00
|
|
|
import chai from 'chai'
|
2019-03-06 14:03:41 +03:00
|
|
|
import MgBotApiClient from '../index'
|
2019-02-08 13:31:38 +03:00
|
|
|
|
|
|
|
describe('#Constructor', function () {
|
|
|
|
it('Empty url', function () {
|
|
|
|
chai.expect(function() {
|
2019-03-06 14:03:41 +03:00
|
|
|
new MgBotApiClient({token: 'test_token'});
|
2019-02-08 13:31:38 +03:00
|
|
|
}).to.throw('Url is required');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('Incorrect url', function () {
|
|
|
|
chai.expect(function() {
|
2019-03-06 14:03:41 +03:00
|
|
|
new MgBotApiClient({
|
2019-02-08 13:31:38 +03:00
|
|
|
host: 'http://api.example.com',
|
|
|
|
token: 'test_token'
|
|
|
|
});
|
|
|
|
}).to.throw('HTTPS required');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('Empty token', function () {
|
|
|
|
chai.expect(function() {
|
2019-03-06 14:03:41 +03:00
|
|
|
new MgBotApiClient({host: 'https://api.example.com'});
|
2019-02-08 13:31:38 +03:00
|
|
|
}).to.throw('Token is required');
|
|
|
|
});
|
|
|
|
});
|