mirror of
https://github.com/scratchfoundation/scratch-paint.git
synced 2024-12-22 13:32:28 -05:00
Add mock for react-intl
This commit is contained in:
parent
26dbb30a83
commit
e2f70a68ba
1 changed files with 24 additions and 0 deletions
24
test/__mocks__/react-intl.js
vendored
Normal file
24
test/__mocks__/react-intl.js
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
import React from 'react';
|
||||
const Intl = require.requireActual('react-intl');
|
||||
|
||||
// Here goes intl context injected into component, feel free to extend
|
||||
const intl = {
|
||||
formatMessage: ({defaultMessage}) => defaultMessage,
|
||||
formatDate: ({defaultMessage}) => defaultMessage,
|
||||
formatTime: ({defaultMessage}) => defaultMessage,
|
||||
formatRelative: ({defaultMessage}) => defaultMessage,
|
||||
formatNumber: ({defaultMessage}) => defaultMessage,
|
||||
formatPlural: ({defaultMessage}) => defaultMessage,
|
||||
formatHTMLMessage: ({defaultMessage}) => defaultMessage,
|
||||
now: () => 0
|
||||
};
|
||||
|
||||
Intl.injectIntl = Node => {
|
||||
const renderWrapped = props => <Node {...props} intl={intl} />;
|
||||
renderWrapped.displayName = Node.displayName ||
|
||||
Node.name ||
|
||||
'Component';
|
||||
return renderWrapped;
|
||||
};
|
||||
|
||||
module.exports = Intl;
|
Loading…
Reference in a new issue