-
Notifications
You must be signed in to change notification settings - Fork 319
/
Copy pathgrowl.js
42 lines (35 loc) · 1.16 KB
/
growl.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
const Notify = require('../notifiers/growl');
const growly = require('growly');
describe('growl', function() {
beforeEach(function() {
this.original = growly.notify;
});
afterEach(function() {
growly.notify = this.original;
});
it('should have overridable host and port', function() {
let notifier = new Notify();
expect(notifier.options.host).toBeUndefined();
expect(notifier.options.port).toBeUndefined();
notifier = new Notify({ host: 'foo', port: 'bar' });
expect(notifier.options.host).toBe('foo');
expect(notifier.options.port).toBe('bar');
});
it('should pass host and port to growly', function(done) {
growly.notify = function() {
expect(this.host).toBe('foo');
expect(this.port).toBe('bar');
done();
};
const notifier = new Notify({ host: 'foo', port: 'bar' });
notifier.notify({ message: 'foo', wait: true });
});
it('should not override host/port if no options passed', function(done) {
growly.notify = function() {
expect(this.host).toBeUndefined();
expect(this.port).toBeUndefined();
done();
};
new Notify().notify({ message: 'foo', wait: true });
});
});