UNPKG

1.25 kBJavaScriptView Raw
1var Notify = require('../notifiers/growl'),
2 should = require('should'),
3 growly = require('growly');
4
5describe('growl', function(){
6
7 beforeEach(function () {
8 this.original = growly.notify;
9 });
10
11 afterEach(function () {
12 growly.notify = this.original;
13 });
14
15
16 it('should have overridable host and port', function ({
17 var notifier = new Notify();
18 should(notifier.options.host).equal(void 0);
19 should(notifier.options.port).equal(void 0);
20
21 notifier = new Notify({ host: 'foo', port: 'bar' });
22 should(notifier.options.host).equal('foo');
23 should(notifier.options.port).equal('bar');
24 });
25
26 it('should pass host and port to growly', function (done{
27 growly.notify = function () {
28 should(this.host).equal('foo');
29 should(this.port).equal('bar');
30 done();
31 };
32
33 var notifier = new Notify({ host: 'foo', port: 'bar' });
34 notifier.notify({ message: "foo", wait: true });
35 });
36
37 it('should not override host/port if no options passed', function (done{
38 growly.notify = function () {
39 should(this.host).equal(void 0);
40 should(this.port).equal(void 0);
41 done();
42 };
43
44 var notifier = new Notify();
45 notifier.notify({ message: "foo", wait: true });
46 });
47
48});