From afa72797832fd96fb4b44bf4f5cfdd3e8a650d70 Mon Sep 17 00:00:00 2001 From: Matt Travi Date: Thu, 17 May 2018 16:40:20 -0500 Subject: [PATCH] feat(server): passed the server instance to the store configurator 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 --- src/route.js | 2 +- test/unit/route-test.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/route.js b/src/route.js index 283e9dc0..7f4f1d5f 100644 --- a/src/route.js +++ b/src/route.js @@ -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}) }) }); diff --git a/test/unit/route-test.js b/test/unit/route-test.js index caa9d1f6..9dddb7e2 100644 --- a/test/unit/route-test.js +++ b/test/unit/route-test.js @@ -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({