aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/helpers/testUtils.ts
diff options
context:
space:
mode:
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>2017-08-18 17:47:37 +0200
committerGrégoire Aubert <gregoire.aubert@sonarsource.com>2017-08-25 11:05:36 +0200
commitf6276b3b6fecce2b160ed8bdc62a3e87439249e4 (patch)
treed1c69e7f786b8693fb13dd816624794eb6b07ae7 /server/sonar-web/src/main/js/helpers/testUtils.ts
parent1ddf3ee7dbf26116afb767003a8a0698965c4f70 (diff)
downloadsonarqube-f6276b3b6fecce2b160ed8bdc62a3e87439249e4.tar.gz
sonarqube-f6276b3b6fecce2b160ed8bdc62a3e87439249e4.zip
SONAR-9385 SONAR-9436 Replace moment with react-intl
Diffstat (limited to 'server/sonar-web/src/main/js/helpers/testUtils.ts')
-rw-r--r--server/sonar-web/src/main/js/helpers/testUtils.ts9
1 files changed, 8 insertions, 1 deletions
diff --git a/server/sonar-web/src/main/js/helpers/testUtils.ts b/server/sonar-web/src/main/js/helpers/testUtils.ts
index deed3501e74..a0931769355 100644
--- a/server/sonar-web/src/main/js/helpers/testUtils.ts
+++ b/server/sonar-web/src/main/js/helpers/testUtils.ts
@@ -17,7 +17,8 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-import { ShallowWrapper } from 'enzyme';
+import { shallow, ShallowWrapper } from 'enzyme';
+import { IntlProvider } from 'react-intl';
export const mockEvent = {
target: { blur() {} },
@@ -69,3 +70,9 @@ export function doAsync(fn: Function): Promise<void> {
}, 0);
});
}
+
+const intlProvider = new IntlProvider({ locale: 'en' }, {});
+const { intl } = intlProvider.getChildContext();
+export function shallowWithIntl(node, options = {}) {
+ return shallow(node, { ...options, context: { intl, ...options.context } });
+}