Skip to content

Commit

Permalink
feat(server): passed the server instance to the store configurator
Browse files Browse the repository at this point in the history
this allows it to be provided downstream for SSR logic triggered by redux middleware to have access
to the server instance for internal routing and other needs
  • Loading branch information
travi committed May 17, 2018
1 parent 98d0ce5 commit afa7279
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export function register(server, options, next) {
routes: options.routes,
respond: options.respond,
Root: options.Root,
store: options.configureStore({session: {auth: request.auth.credentials}})
store: options.configureStore({session: {auth: request.auth.credentials}, server})
})
});

Expand Down
5 changes: 3 additions & 2 deletions test/unit/route-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,13 @@ suite('route', () => {
const auth = {credentials: any.simpleObject()};
const request = {...any.simpleObject(), auth};
const reply = any.simpleObject();
const server = {route};
const Root = any.simpleObject();
const store = any.simpleObject();
const configureStore = sinon.stub();
configureStore.withArgs({session: {auth: auth.credentials}}).returns(store);
configureStore.withArgs({session: {auth: auth.credentials}, server}).returns(store);

register({route}, {respond, routes, Root, configureStore}, next);
register(server, {respond, routes, Root, configureStore}, next);

assert.calledOnce(next);
assert.calledWith(route, sinon.match({
Expand Down

0 comments on commit afa7279

Please sign in to comment.