From f4b2ae772fc5c73d8d407be97602f918d0f5230f Mon Sep 17 00:00:00 2001 From: Michael Behrisch <m.behrisch@uu.nl> Date: Sat, 5 Feb 2022 21:51:10 +0100 Subject: [PATCH] test: :white_check_mark: adds redux to main app story This test failed until now to provide at storybook component as the redux store was not accessible. --- apps/graphpolaris/src/app/app.stories.tsx | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/apps/graphpolaris/src/app/app.stories.tsx b/apps/graphpolaris/src/app/app.stories.tsx index ababe8b4e..ce5c645eb 100644 --- a/apps/graphpolaris/src/app/app.stories.tsx +++ b/apps/graphpolaris/src/app/app.stories.tsx @@ -1,12 +1,30 @@ -import { Story, Meta } from '@storybook/react'; +import { configureStore } from '@reduxjs/toolkit'; +import { Meta, Story } from '@storybook/react'; +import React from 'react'; +import { Provider } from 'react-redux'; +import graphQueryResultSlice from '../../../../libs/shared/data-access/store/src/lib/graphQueryResultSlice'; import { App } from './app'; export default { component: App, title: 'App', + decorators: [ + (story) => ( + <div style={{ padding: '3rem' }}> + <Provider store={Mockstore}>{story()}</Provider> + </div> + ), + ], } as Meta; const Template: Story = (args) => <App {...args} />; +// A super-simple mock of a redux store +const Mockstore = configureStore({ + reducer: { + graphQueryResult: graphQueryResultSlice, + }, +}); + export const Primary = Template.bind({}); Primary.args = {}; -- GitLab