-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpugme.spec.js
45 lines (38 loc) · 1.26 KB
/
pugme.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
const Helper = require('hubot-test-helper');
const co = require('co');
const { expect } = require('chai');
const helper = new Helper('../scripts/');
describe('robotk pugme', () => {
beforeEach(() => {
this.room = helper.createRoom();
});
afterEach(() => {
this.room.destroy();
});
context('user requests to pug them', () => {
beforeEach(() =>
co(
function* userSay() {
yield this.room.user.say('alice', '@hubot pug me');
yield new Promise(resolve => setTimeout(resolve, 1000)); // Damn it yash.
}.bind(this)
));
it('should reply to the user with a pug pic', () => {
expect(this.room.messages.length).to.equal(2);
expect(this.room.messages[1][1]).to.contain('media.tumblr.com');
});
});
context('user requests to pug bomb them', () => {
beforeEach(() =>
co(
function* userSay() {
yield this.room.user.say('alice', '@hubot pug bomb 3');
yield new Promise(resolve => setTimeout(resolve, 1000)); // Damn it yash.
}.bind(this)
));
it('should reply to the user with a wave of pug pics', () => {
expect(this.room.messages.length).to.equal(4);
expect(this.room.messages[3][1]).to.contain('You dun goofed now!');
});
});
});