-
Notifications
You must be signed in to change notification settings - Fork 756
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(api): expose sockets to public api
- Loading branch information
Shane Osbourne
committed
Jun 17, 2015
1 parent
c32bec6
commit 985682c
Showing
2 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
"use strict"; | ||
|
||
var browserSync = require("../../../"); | ||
|
||
var assert = require("chai").assert; | ||
|
||
describe("API: .sockets", function () { | ||
|
||
it("has access before Browsersync is running via stubs", function (done) { | ||
browserSync.reset(); | ||
var bs = browserSync.create(); | ||
bs.init({ | ||
logLevel: "silent" | ||
}, function (err, bs) { | ||
bs.cleanup(); | ||
done(); | ||
}); | ||
assert.isFunction(bs.sockets.on); | ||
assert.isFunction(bs.sockets.emit); | ||
}); | ||
it("has access after Browsersync is running", function (done) { | ||
browserSync.reset(); | ||
var bs = browserSync.create(); | ||
bs.init({ | ||
logLevel: "silent" | ||
}, function (err, _bs) { | ||
assert.isFunction(bs.sockets.emit); | ||
assert.isFunction(bs.sockets.on); | ||
_bs.cleanup(); | ||
done(); | ||
}); | ||
}); | ||
it("has access before Browsersync is running via main module export + stubs", function (done) { | ||
browserSync.reset(); | ||
var bs = browserSync({ | ||
logLevel: "silent" | ||
}, function (err, bs) { | ||
bs.cleanup(); | ||
done(); | ||
}); | ||
assert.isFunction(bs.sockets.on); | ||
assert.isFunction(bs.sockets.emit); | ||
}); | ||
}); |