Skip to content

Commit

Permalink
Add not-functional test for server side render
Browse files Browse the repository at this point in the history
Ref #121
  • Loading branch information
SpaceK33z committed Sep 11, 2016
1 parent 2fd0912 commit 532ca57
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
30 changes: 30 additions & 0 deletions test/Server.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
var middleware = require("../middleware");
var express = require("express");
var webpack = require("webpack");
var should = require("should");
var request = require("supertest");
var webpackConfig = require("./fixtures/server-test/webpack.config");

Expand Down Expand Up @@ -85,4 +86,33 @@ describe("Server", function() {
.expect(200, done);
});
});

describe.only("server side render", function() {
var locals;
before(function(done) {
app = express();
var compiler = webpack(webpackConfig);
app.use(middleware(compiler, {
stats: "errors-only",
quiet: true,
serverSideRender: true,
}));
app.use(function(req, res) {
locals = res.locals;
});
listen = listenShorthand(done);
});
after(close);

it("request to bundle file", function(done) {
this.timeout(5000);
request(app).get("/bundle.js")
.expect(200, function() {
// TODO: I would expect `locals` to be set here.
// note that the liner underneath is purely to please the linter
should.strictEqual(locals, undefined);
done();
});
});
});
});
1 change: 0 additions & 1 deletion test/fixtures/server-test/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
module.exports = {
quiet: true,
context: __dirname,
entry: "./index.js",
output: {
Expand Down

0 comments on commit 532ca57

Please sign in to comment.