Skip to content

Commit

Permalink
[Fix #193] Mock intl fox question stories
Browse files Browse the repository at this point in the history
  • Loading branch information
LaChope committed Apr 23, 2024
1 parent 9b6a716 commit 81a7bbb
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/stories/Question.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import question from "./assets/question/question.json";
import answerableQuestion from "./assets/question/answerableQuestion.json";
import answerableQuestionExpanded from "./assets/question/answerableQuestionExpanded.json";
import queryString from "query-string";
import IntlContextProvider from "../contexts/IntlContextProvider";

export default {
title: "Components/Question",
Expand Down Expand Up @@ -73,6 +74,11 @@ const Template: ComponentStory<typeof Question> = (
};
const mapComponent = _getComponentMappingFunction();
const getOptions = (id: number) => options[id] || [];
const Intl = jest.genMockFromModule("react-intl"); // <-- This is the change

const intl = {
formatMessage: ({ defaultMessage }) => defaultMessage,
};

return (
<ConfigurationContext.Provider
Expand All @@ -85,7 +91,7 @@ const Template: ComponentStory<typeof Question> = (
}}
>
<FormGenContext.Provider value={{ getOptions }}>
<Question {...args} onChange={() => {}} />
<Question {...args} onChange={() => {}} intl={intl} />
</FormGenContext.Provider>
</ConfigurationContext.Provider>
);
Expand Down

0 comments on commit 81a7bbb

Please sign in to comment.