Skip to content

Commit

Permalink
fix: change getFakeI18nInst to fakeI18n (#3355)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsl143 authored and willdurand committed Oct 5, 2017
1 parent 98b5e18 commit 07609f3
Show file tree
Hide file tree
Showing 54 changed files with 122 additions and 123 deletions.
4 changes: 2 additions & 2 deletions tests/unit/amo/components/TestAddon.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ import {
import {
createFetchAddonResult,
createStubErrorHandler,
getFakeI18nInst,
fakeI18n,
sampleUserAgentParsed,
shallowUntilTarget,
} from 'tests/unit/helpers';
Expand All @@ -73,7 +73,7 @@ function renderProps({
setCurrentStatus = sinon.spy(),
...customProps
} = {}) {
const i18n = getFakeI18nInst();
const i18n = fakeI18n();
const addonProps = addon || {};
return {
addon,
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/amo/components/TestAddonCompatibilityError.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
INCOMPATIBLE_UNDER_MIN_VERSION,
} from 'core/constants';
import { signedInApiState } from 'tests/unit/amo/helpers';
import { getFakeI18nInst, shallowUntilTarget } from 'tests/unit/helpers';
import { fakeI18n, shallowUntilTarget } from 'tests/unit/helpers';


describe(__filename, () => {
Expand All @@ -30,7 +30,7 @@ describe(__filename, () => {
const { store } = createStore({ api });

const defaultProps = {
i18n: getFakeI18nInst(),
i18n: fakeI18n(),
minVersion: null,
store,
};
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/amo/components/TestAddonMeta.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
dispatchSignInActions,
fakeAddon,
} from 'tests/unit/amo/helpers';
import { getFakeI18nInst, shallowUntilTarget } from 'tests/unit/helpers';
import { fakeI18n, shallowUntilTarget } from 'tests/unit/helpers';
import LoadingText from 'ui/components/LoadingText';
import Rating from 'ui/components/Rating';

Expand All @@ -22,7 +22,7 @@ describe(__filename, () => {
return shallowUntilTarget(
<AddonMeta
addon={addon}
i18n={getFakeI18nInst()}
i18n={fakeI18n()}
store={store}
{...props}
/>,
Expand Down Expand Up @@ -59,7 +59,7 @@ describe(__filename, () => {
});

it('localizes the user count', () => {
const i18n = getFakeI18nInst({ lang: 'de' });
const i18n = fakeI18n({ lang: 'de' });
const root = render({
addon: createInternalAddon({
...fakeAddon,
Expand Down Expand Up @@ -152,7 +152,7 @@ describe(__filename, () => {
});

it('localizes review count', () => {
const i18n = getFakeI18nInst({ lang: 'de' });
const i18n = fakeI18n({ lang: 'de' });
const root = renderRatings({ count: 1000 }, { i18n });
expect(getReviewCount(root)).toContain('1.000');
});
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/amo/components/TestAddonMoreInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
fakeAddon,
fakeTheme,
} from 'tests/unit/amo/helpers';
import { getFakeI18nInst, shallowUntilTarget } from 'tests/unit/helpers';
import { fakeI18n, shallowUntilTarget } from 'tests/unit/helpers';
import LoadingText from 'ui/components/LoadingText';


Expand All @@ -28,7 +28,7 @@ describe(__filename, () => {
return shallowUntilTarget(
<AddonMoreInfo
addon={props.addon || createInternalAddon(fakeAddon)}
i18n={getFakeI18nInst()}
i18n={fakeI18n()}
store={store}
{...props}
/>,
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/amo/components/TestAddonReview.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
dispatchClientMetadata, fakeAddon, fakeReview, signedInApiState,
} from 'tests/unit/amo/helpers';
import {
createFakeEvent, createStubErrorHandler, getFakeI18nInst, shallowUntilTarget,
createFakeEvent, createStubErrorHandler, fakeI18n, shallowUntilTarget,
} from 'tests/unit/helpers';
import OverlayCard from 'ui/components/OverlayCard';
import Rating from 'ui/components/Rating';
Expand Down Expand Up @@ -46,7 +46,7 @@ describe(__filename, () => {
return {
createLocalState: () => fakeLocalState(),
errorHandler: createStubErrorHandler(),
i18n: getFakeI18nInst(),
i18n: fakeI18n(),
onReviewSubmitted: () => {},
refreshAddon: () => Promise.resolve(),
review: defaultReview,
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/amo/components/TestAddonReviewList.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
import {
createFetchAddonResult,
createStubErrorHandler,
getFakeI18nInst,
fakeI18n,
shallowUntilTarget,
} from 'tests/unit/helpers';
import { setError } from 'core/actions/errors';
Expand All @@ -46,7 +46,7 @@ describe(__filename, () => {
...customProps
} = {}) => {
const props = {
i18n: getFakeI18nInst(),
i18n: fakeI18n(),
location: { query: {} },
params,
store,
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/amo/components/TestAddonReviewListItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
} from 'tests/unit/amo/helpers';
import {
createFakeEvent,
getFakeI18nInst,
fakeI18n,
shallowUntilTarget,
} from 'tests/unit/helpers';
import ErrorList from 'ui/components/ErrorList';
Expand All @@ -37,7 +37,7 @@ describe(__filename, () => {

const render = (customProps = {}) => {
const props = {
i18n: getFakeI18nInst(),
i18n: fakeI18n(),
store,
...customProps,
};
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/amo/components/TestCategories.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
import Button from 'ui/components/Button';
import LoadingText from 'ui/components/LoadingText';
import { dispatchClientMetadata, fakeCategory } from 'tests/unit/amo/helpers';
import { createStubErrorHandler, getFakeI18nInst } from 'tests/unit/helpers';
import { createStubErrorHandler, fakeI18n } from 'tests/unit/helpers';
import ErrorList from 'ui/components/ErrorList';


Expand All @@ -29,7 +29,7 @@ describe('<Categories />', () => {
addonType={ADDON_TYPE_EXTENSION}
dispatch={store.dispatch}
errorHandler={errorHandler}
i18n={getFakeI18nInst()}
i18n={fakeI18n()}
{...mapStateToProps(store.getState())}
{...props}
/>
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/amo/components/TestCategory.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
CLIENT_APP_FIREFOX,
} from 'core/constants';
import { visibleAddonType } from 'core/utils';
import { createStubErrorHandler, getFakeI18nInst } from 'tests/unit/helpers';
import { createStubErrorHandler, fakeI18n } from 'tests/unit/helpers';
import { dispatchClientMetadata, fakeCategory } from 'tests/unit/amo/helpers';
import ErrorList from 'ui/components/ErrorList';

Expand Down Expand Up @@ -53,7 +53,7 @@ describe('Category', () => {
...mapStateToProps(state),
dispatch: store.dispatch,
errorHandler,
i18n: getFakeI18nInst(),
i18n: fakeI18n(),
location: { query: {} },
params: {
slug: fakeCategory.slug,
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/amo/components/TestCategoryHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
} from 'core/constants';
import { getCategoryColor } from 'core/utils';
import LoadingText from 'ui/components/LoadingText';
import { getFakeI18nInst } from 'tests/unit/helpers';
import { fakeI18n } from 'tests/unit/helpers';


describe(__filename, () => {
Expand All @@ -30,7 +30,7 @@ describe(__filename, () => {
return shallow(
<CategoryHeaderBase
category={category}
i18n={getFakeI18nInst()}
i18n={fakeI18n()}
{...props}
/>
);
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/amo/components/TestCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { createApiError } from 'core/api/index';
import { ErrorHandler } from 'core/errorHandler';
import {
createStubErrorHandler,
getFakeI18nInst,
fakeI18n,
shallowUntilTarget,
} from 'tests/unit/helpers';
import {
Expand All @@ -32,7 +32,7 @@ describe(__filename, () => {
const getProps = () => ({
dispatch: sinon.stub(),
errorHandler: createStubErrorHandler(),
i18n: getFakeI18nInst(),
i18n: fakeI18n(),
location: { query: {} },
params: {
user: 'user-id-or-name',
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/amo/components/TestDownloadFirefoxButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import DownloadFirefoxButton, {
} from 'amo/components/DownloadFirefoxButton';
import { dispatchClientMetadata } from 'tests/unit/amo/helpers';
import {
getFakeI18nInst,
fakeI18n,
shallowUntilTarget,
userAgents,
} from 'tests/unit/helpers';
Expand All @@ -17,7 +17,7 @@ describe(__filename, () => {

return shallowUntilTarget(
<DownloadFirefoxButton
i18n={getFakeI18nInst()}
i18n={fakeI18n()}
store={store}
{...props}
/>,
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/amo/components/TestFeaturedAddons.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
dispatchSignInActions,
fakeAddon,
} from 'tests/unit/amo/helpers';
import { createStubErrorHandler, getFakeI18nInst } from 'tests/unit/helpers';
import { createStubErrorHandler, fakeI18n } from 'tests/unit/helpers';


describe('<FeaturedAddons />', () => {
Expand Down Expand Up @@ -52,7 +52,7 @@ describe('<FeaturedAddons />', () => {
addonType: ADDON_TYPE_EXTENSION,
dispatch: sinon.stub(),
errorHandler,
i18n: getFakeI18nInst(),
i18n: fakeI18n(),
loading: false,
params: {
visibleAddonType: visibleAddonType(ADDON_TYPE_EXTENSION),
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/amo/components/TestFooter.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Provider } from 'react-redux';
import Footer from 'amo/components/Footer';
import I18nProvider from 'core/i18n/Provider';
import { dispatchSignInActions } from 'tests/unit/amo/helpers';
import { getFakeI18nInst } from 'tests/unit/helpers';
import { fakeI18n } from 'tests/unit/helpers';


describe('Footer', () => {
Expand All @@ -18,7 +18,7 @@ describe('Footer', () => {

return findDOMNode(findRenderedComponentWithType(renderIntoDocument(
<Provider store={store}>
<I18nProvider i18n={getFakeI18nInst()}>
<I18nProvider i18n={fakeI18n()}>
<Footer {...props} />
</I18nProvider>
</Provider>
Expand Down
5 changes: 2 additions & 3 deletions tests/unit/amo/components/TestHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
} from 'tests/unit/amo/helpers';
import {
createFakeEvent,
getFakeI18nInst,
fakeI18n,
shallowUntilTarget,
} from 'tests/unit/helpers';

Expand All @@ -22,9 +22,8 @@ describe(__filename, () => {
store = dispatchClientMetadata().store,
...props
} = {}) {
const fakeI18n = getFakeI18nInst();
const allProps = {
i18n: fakeI18n,
i18n: fakeI18n(),
location: {},
query: '',
...props,
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/amo/components/TestHomeCarousel.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';

import { getFakeI18nInst, shallowUntilTarget } from 'tests/unit/helpers';
import { fakeI18n, shallowUntilTarget } from 'tests/unit/helpers';
import HomeCarousel, { HomeCarouselBase } from 'amo/components/HomeCarousel';
import Carousel from 'ui/components/Carousel';

Expand All @@ -10,7 +10,7 @@ describe(__filename, () => {
...props
} = {}) {
return shallowUntilTarget(
<HomeCarousel i18n={getFakeI18nInst()} {...props} />,
<HomeCarousel i18n={fakeI18n()} {...props} />,
HomeCarouselBase
);
}
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/amo/components/TestLandingPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import I18nProvider from 'core/i18n/Provider';
import { ErrorHandler } from 'core/errorHandler';
import { visibleAddonType } from 'core/utils';
import { dispatchClientMetadata, fakeAddon } from 'tests/unit/amo/helpers';
import { createStubErrorHandler, getFakeI18nInst } from 'tests/unit/helpers';
import { createStubErrorHandler, fakeI18n } from 'tests/unit/helpers';
import ErrorList from 'ui/components/ErrorList';


Expand All @@ -25,7 +25,7 @@ describe('<LandingPage />', () => {
return {
dispatch: sinon.stub(),
errorHandler: createStubErrorHandler(),
i18n: getFakeI18nInst(),
i18n: fakeI18n(),
params: { visibleAddonType: visibleAddonType(ADDON_TYPE_EXTENSION) },
resultsLoaded: false,
...props,
Expand All @@ -42,7 +42,7 @@ describe('<LandingPage />', () => {
const { store } = dispatchClientMetadata();
return mount(
<Provider store={store}>
<I18nProvider i18n={getFakeI18nInst()}>
<I18nProvider i18n={fakeI18n()}>
<LandingPageBase {...renderProps(props)} />
</I18nProvider>
</Provider>
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/amo/components/TestLanguagePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
LanguagePickerBase,
changeLocaleURL,
} from 'amo/components/LanguagePicker';
import { getFakeI18nInst } from 'tests/unit/helpers';
import { fakeI18n } from 'tests/unit/helpers';


describe('LanguagePicker', () => {
Expand All @@ -22,7 +22,7 @@ describe('LanguagePicker', () => {

return findRenderedComponentWithType(renderIntoDocument(
<Provider store={store}>
<LanguagePickerBase i18n={getFakeI18nInst()} {...props} />
<LanguagePickerBase i18n={fakeI18n()} {...props} />
</Provider>
), LanguagePickerBase);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/amo/components/TestNotAuthorized.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import NotAuthorized from 'amo/components/ErrorPage/NotAuthorized';
import { createApiError } from 'core/api';
import I18nProvider from 'core/i18n/Provider';
import { dispatchSignInActions } from 'tests/unit/amo/helpers';
import { getFakeI18nInst } from 'tests/unit/helpers';
import { fakeI18n } from 'tests/unit/helpers';


describe('<NotAuthorized />', () => {
Expand All @@ -25,7 +25,7 @@ describe('<NotAuthorized />', () => {

return findDOMNode(findRenderedComponentWithType(renderIntoDocument(
<Provider store={store}>
<I18nProvider i18n={getFakeI18nInst()}>
<I18nProvider i18n={fakeI18n()}>
<NotAuthorized {...props} />
</I18nProvider>
</Provider>
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/amo/components/TestNotFound.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import NotFound from 'amo/components/ErrorPage/NotFound';
import { createApiError } from 'core/api';
import I18nProvider from 'core/i18n/Provider';
import { dispatchSignInActions } from 'tests/unit/amo/helpers';
import { getFakeI18nInst } from 'tests/unit/helpers';
import { fakeI18n } from 'tests/unit/helpers';


describe('<NotFound />', () => {
Expand All @@ -25,7 +25,7 @@ describe('<NotFound />', () => {

return findDOMNode(findRenderedComponentWithType(renderIntoDocument(
<Provider store={store}>
<I18nProvider i18n={getFakeI18nInst()}>
<I18nProvider i18n={fakeI18n()}>
<NotFound {...props} />
</I18nProvider>
</Provider>
Expand Down
Loading

0 comments on commit 07609f3

Please sign in to comment.