forked from gesinn-it-pub/mwbot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MWBot.spec.js
49 lines (40 loc) · 1.29 KB
/
MWBot.spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
'use strict';
/*global describe, it*/
const MWBot = require('../src/');
const expect = require('chai').expect;
describe('MWBot', function() {
it('can be constructed', function() {
let bot = new MWBot();
expect(bot).to.be.an('object');
});
it('can be constructed with options', function() {
let bot = new MWBot({
verbose: true
});
expect(bot).to.be.an('object');
expect(bot.options.verbose).to.equal(true);
});
it('has a valid semver version number', function() {
let bot = new MWBot();
expect(bot.version).to.be.a('string');
expect(bot.version).to.match(/^(\d+\.)?(\d+\.)?(\*|\d+)$/);
});
it('set custom options', function() {
let bot = new MWBot();
bot.setOptions({
verbose: true
});
expect(bot).to.be.an('object');
expect(bot.options.verbose).to.equal(true);
});
it('set custom global request options', function() {
let bot = new MWBot();
bot.setGlobalRequestOptions({
time: false,
someNewOption: true
});
expect(bot).to.be.an('object');
expect(bot.globalRequestOptions.time).to.equal(false);
expect(bot.globalRequestOptions.someNewOption).to.equal(true);
});
});