-
Notifications
You must be signed in to change notification settings - Fork 754
/
e2e.server.routes.js
67 lines (56 loc) · 1.9 KB
/
e2e.server.routes.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
var browserSync = require("../../../../");
var request = require("supertest");
var assert = require("chai").assert;
describe("E2E server test with routes", function() {
var instance;
before(function(done) {
browserSync.reset();
var config = {
server: {
baseDir: "test/fixtures",
routes: {
"/shane": "test/fixtures",
"/kittie": "test/fixtures",
"/node_modules/": "node_modules"
}
},
logLevel: "silent",
open: false
};
instance = browserSync.init(config, done).instance;
});
after(function() {
instance.cleanup();
});
it("serves files from the route with snippet added", function(done) {
assert.isString(instance.options.get("snippet"));
request(instance.server)
.get("/shane/index.html")
.set("accept", "text/html")
.expect(200)
.end(function(err, res) {
assert.include(res.text, instance.options.get("snippet"));
done();
});
});
it("serves files from the route with snippet added", function(done) {
assert.isString(instance.options.get("snippet"));
request(instance.server)
.get("/kittie/index.html")
.set("accept", "text/html")
.expect(200)
.end(function(err, res) {
assert.include(res.text, instance.options.get("snippet"));
done();
});
});
it("serves the client script", function(done) {
request(instance.server)
.get(instance.options.getIn(["scriptPaths", "versioned"]))
.expect(200)
.end(function(err, res) {
assert.include(res.text, "window.___browserSync___ = {}");
done();
});
});
});