From 532ca57319581454d9d1adf87ab66dfb7e5f824b Mon Sep 17 00:00:00 2001 From: Kees Kluskens Date: Sun, 11 Sep 2016 14:17:35 +0200 Subject: [PATCH] Add not-functional test for server side render Ref #121 --- test/Server.test.js | 30 +++++++++++++++++++++ test/fixtures/server-test/webpack.config.js | 1 - 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/test/Server.test.js b/test/Server.test.js index 2b2507668..a2556d5d5 100644 --- a/test/Server.test.js +++ b/test/Server.test.js @@ -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"); @@ -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(); + }); + }); + }); }); diff --git a/test/fixtures/server-test/webpack.config.js b/test/fixtures/server-test/webpack.config.js index 708ad76df..47c69409c 100644 --- a/test/fixtures/server-test/webpack.config.js +++ b/test/fixtures/server-test/webpack.config.js @@ -1,5 +1,4 @@ module.exports = { - quiet: true, context: __dirname, entry: "./index.js", output: {