-
Notifications
You must be signed in to change notification settings - Fork 301
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[minor] pass location with query string to routes (#854)
- Loading branch information
Showing
5 changed files
with
113 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
packages/electrode-redux-router-engine/test/spec/electrode-server.integration.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
"use strict"; | ||
|
||
const ReduxRouterEngine = require("../.."); | ||
const expect = require("chai").expect; | ||
const electrodeServer = require("electrode-server"); | ||
|
||
require("babel-register"); | ||
|
||
const routes = require("../routes.jsx").default; | ||
|
||
describe("electrode server (Hapi) integration", function() { | ||
let server; | ||
let engine; | ||
|
||
before(async () => { | ||
server = await electrodeServer({ | ||
electrode: { logLevel: "none" }, | ||
connections: { default: { port: 0 } } | ||
}); | ||
server.route({ | ||
method: "get", | ||
path: "/test", | ||
handler: async (request, reply) => { | ||
if (!engine) engine = new ReduxRouterEngine({ routes }); | ||
const result = await engine.render(request); | ||
reply(result); | ||
} | ||
}); | ||
}); | ||
|
||
after(done => { | ||
server.stop(done); | ||
}); | ||
|
||
it("should render basic test route", () => { | ||
return server.inject("/test").then(resp => { | ||
expect(resp.result).to.deep.equal({ | ||
status: 200, | ||
html: "<div>Page<div>Home</div></div>", | ||
prefetch: "window.__PRELOADED_STATE__ = {};" | ||
}); | ||
}); | ||
}); | ||
|
||
it("should render with URL query", () => { | ||
return server.inject("/test?foo=bar").then(resp => { | ||
expect(resp.result).to.deep.equal({ | ||
status: 200, | ||
html: "<div>Page<div>Home - Query: ?foo=bar</div></div>", | ||
prefetch: "window.__PRELOADED_STATE__ = {};" | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters