Repository navigation
Expand file tree
/
Copy pathinit.notify.js
More file actions
48 lines (40 loc) · 1.44 KB
/
Copy pathinit.notify.js
File metadata and controls
48 lines (40 loc) · 1.44 KB
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
"use strict";
var browserSync = require("../../../");
var sinon = require("sinon");
describe("API: .notify() - Public Notify Method", function () {
var emitterStub, bs;
before(function (done) {
browserSync.reset();
bs = browserSync({
open: false,
online: false,
logLevel: "silent"
}, function () {
emitterStub = sinon.stub(bs.emitter, "emit");
done();
});
});
afterEach(function () {
emitterStub.reset();
});
after(function () {
emitterStub.restore();
bs.cleanup();
});
it("should emit the browser:notify event", function () {
browserSync.notify("HI");
sinon.assert.calledWithExactly(emitterStub, "browser:notify", {message: "HI", timeout: 2000});
});
it("should emit the browser:notify event (2)", function () {
browserSync.notify("HI There");
sinon.assert.calledWithExactly(emitterStub, "browser:notify", {message: "HI There", timeout: 2000});
});
it("should emit the browser:notify event with a timeout", function () {
browserSync.notify("HI There", 3000);
sinon.assert.calledWithExactly(emitterStub, "browser:notify", {message: "HI There", timeout: 3000});
});
it("should NOT emit the browser:notify event if a message was not provided", function () {
browserSync.notify();
sinon.assert.notCalled(emitterStub);
});
});