Skip to content

Commit 532ca57

Browse files
committed
Add not-functional test for server side render
Ref #121
1 parent 2fd0912 commit 532ca57

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

test/Server.test.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
var middleware = require("../middleware");
22
var express = require("express");
33
var webpack = require("webpack");
4+
var should = require("should");
45
var request = require("supertest");
56
var webpackConfig = require("./fixtures/server-test/webpack.config");
67

@@ -85,4 +86,33 @@ describe("Server", function() {
8586
.expect(200, done);
8687
});
8788
});
89+
90+
describe.only("server side render", function() {
91+
var locals;
92+
before(function(done) {
93+
app = express();
94+
var compiler = webpack(webpackConfig);
95+
app.use(middleware(compiler, {
96+
stats: "errors-only",
97+
quiet: true,
98+
serverSideRender: true,
99+
}));
100+
app.use(function(req, res) {
101+
locals = res.locals;
102+
});
103+
listen = listenShorthand(done);
104+
});
105+
after(close);
106+
107+
it("request to bundle file", function(done) {
108+
this.timeout(5000);
109+
request(app).get("/bundle.js")
110+
.expect(200, function() {
111+
// TODO: I would expect `locals` to be set here.
112+
// note that the liner underneath is purely to please the linter
113+
should.strictEqual(locals, undefined);
114+
done();
115+
});
116+
});
117+
});
88118
});

test/fixtures/server-test/webpack.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
module.exports = {
2-
quiet: true,
32
context: __dirname,
43
entry: "./index.js",
54
output: {

0 commit comments

Comments
 (0)