-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathMWBot.prod.spec.js
57 lines (46 loc) · 1.52 KB
/
MWBot.prod.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
50
51
52
53
54
55
56
57
'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('sets API URL', function() {
let bot = new MWBot();
bot.setApiUrl('https://acme.corp');
expect(bot).to.be.an('object');
expect(bot.options.apiUrl).to.equal('https://acme.corp');
});
it('sets 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('sets 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);
});
});