From ca2251e9e88d74b0dedd03c7b951d47078f178a8 Mon Sep 17 00:00:00 2001 From: Filipe Silva Date: Wed, 5 Oct 2016 23:11:53 +0100 Subject: [PATCH] Add failing test for #640 --- test/HistoryApiFallback.test.js | 16 ++++++++++++++++ .../historyapifallback-3-config/bar.html | 1 + .../fixtures/historyapifallback-3-config/foo.js | 2 ++ .../historyapifallback-3-config/index.html | 1 + .../webpack.config.js | 17 +++++++++++++++++ 5 files changed, 37 insertions(+) create mode 100644 test/fixtures/historyapifallback-3-config/bar.html create mode 100644 test/fixtures/historyapifallback-3-config/foo.js create mode 100644 test/fixtures/historyapifallback-3-config/index.html create mode 100644 test/fixtures/historyapifallback-3-config/webpack.config.js diff --git a/test/HistoryApiFallback.test.js b/test/HistoryApiFallback.test.js index 72118eb887..a8c62c78e6 100644 --- a/test/HistoryApiFallback.test.js +++ b/test/HistoryApiFallback.test.js @@ -110,4 +110,20 @@ describe("HistoryApiFallback", function() { .expect(200, /Other file/, done); }); }); + + describe("in-memory files", function() { + before(function(done) { + server = helper.start(config2, { + contentBase: path.join(__dirname, "fixtures/historyapifallback-3-config"), + historyApiFallback: true + }, done); + req = request(server.app); + }); + + it("should take precedence over contentBase files", function(done) { + req.get("/foo") + .accept("html") + .expect(200, /In-memory file/, done); + }); + }); }); diff --git a/test/fixtures/historyapifallback-3-config/bar.html b/test/fixtures/historyapifallback-3-config/bar.html new file mode 100644 index 0000000000..5dee24d5b3 --- /dev/null +++ b/test/fixtures/historyapifallback-3-config/bar.html @@ -0,0 +1 @@ +In-memory file diff --git a/test/fixtures/historyapifallback-3-config/foo.js b/test/fixtures/historyapifallback-3-config/foo.js new file mode 100644 index 0000000000..5f6793297e --- /dev/null +++ b/test/fixtures/historyapifallback-3-config/foo.js @@ -0,0 +1,2 @@ +require("./bar.html"); +console.log("Hey."); diff --git a/test/fixtures/historyapifallback-3-config/index.html b/test/fixtures/historyapifallback-3-config/index.html new file mode 100644 index 0000000000..f9df3295a7 --- /dev/null +++ b/test/fixtures/historyapifallback-3-config/index.html @@ -0,0 +1 @@ +contentBase file diff --git a/test/fixtures/historyapifallback-3-config/webpack.config.js b/test/fixtures/historyapifallback-3-config/webpack.config.js new file mode 100644 index 0000000000..4646d938ca --- /dev/null +++ b/test/fixtures/historyapifallback-3-config/webpack.config.js @@ -0,0 +1,17 @@ +module.exports = { + context: __dirname, + entry: "./foo.js", + output: { + filename: "bundle.js", + path: "/" + }, + module: { + loaders: [ + { + test: /\.html$/, + loader: "file", + query: { name: "index.html" } + } + ] + } +};