// @flow
import React from 'react';
import { IntlProvider, addLocaleData } from 'react-intl';
import type { StoryDecorator } from '@storybook/react';
import englishLocaleData from 'react-intl/locale-data/en';

addLocaleData(englishLocaleData);

const testMessages = { test: 'Localized string' };

export const intlDecorator: StoryDecorator = (story, context) => (
  <IntlProvider locale="en-CA" messages={testMessages}>
    <React.Fragment>{story(context)}</React.Fragment>
  </IntlProvider>
);
