@@ -19,6 +19,7 @@ import helpers from '@ml/oceans/helpers';
1919import { setState , getState , resetState } from '@ml/oceans/state' ;
2020import { AppMode , Modes } from '@ml/oceans/constants' ;
2121import colors from '@ml/oceans/colors' ;
22+ import * as I18n from '@ml/oceans/i18n' ;
2223
2324const DEFAULT_PROPS = {
2425 // radiumConfig.userAgent is required because our unit tests run in the "node" testEnvironment
@@ -95,6 +96,10 @@ describe('Button', () => {
9596describe ( 'ConfirmationDialog' , ( ) => {
9697 let onYesClickSpy , onNoClickSpy ;
9798
99+ beforeAll ( ( ) => {
100+ I18n . init ( ) ;
101+ } ) ;
102+
98103 beforeEach ( ( ) => {
99104 onYesClickSpy = sinon . spy ( ) ;
100105 onNoClickSpy = sinon . spy ( ) ;
@@ -137,6 +142,7 @@ describe('Words', () => {
137142 } ) ;
138143
139144 it ( 'selects the set of words based on the current appMode' , ( ) => {
145+ I18n . init ( ) ;
140146 const appMode = AppMode . FishShort ;
141147 setState ( { appMode} ) ;
142148 const wrapper = shallow ( < Words { ...DEFAULT_PROPS } /> ) ;
@@ -163,6 +169,9 @@ describe('Words', () => {
163169
164170 describe ( 'onChangeWord' , ( ) => {
165171 let toModeStub ;
172+ beforeAll ( ( ) => {
173+ I18n . init ( ) ;
174+ } ) ;
166175
167176 beforeEach ( ( ) => {
168177 toModeStub = sinon . stub ( modeHelpers , 'toMode' ) ;
@@ -182,7 +191,7 @@ describe('Words', () => {
182191 . find ( 'Button' )
183192 . at ( i )
184193 . simulate ( 'click' ) ;
185- const expectedWord = wrapper . state ( ) . choices [ i ] ;
194+ const expectedWord = I18n . t ( wrapper . state ( ) . choices [ i ] ) ;
186195 expect ( getState ( ) . word ) . toEqual ( expectedWord ) ;
187196 } ) ;
188197
@@ -212,6 +221,10 @@ describe('Words', () => {
212221describe ( 'Train' , ( ) => {
213222 let classifyFishStub ;
214223
224+ beforeAll ( ( ) => {
225+ I18n . init ( ) ;
226+ } ) ;
227+
215228 beforeEach ( ( ) => {
216229 classifyFishStub = sinon . stub ( train , 'onClassifyFish' ) ;
217230 } ) ;
@@ -334,6 +347,10 @@ describe('Train', () => {
334347} ) ;
335348
336349describe ( 'Predict' , ( ) => {
350+ beforeAll ( ( ) => {
351+ I18n . init ( ) ;
352+ } ) ;
353+
337354 afterEach ( ( ) => {
338355 resetState ( ) ;
339356 } ) ;
@@ -503,6 +520,10 @@ describe('Pond', () => {
503520 describe ( 'navigation' , ( ) => {
504521 let toModeStub ;
505522
523+ beforeAll ( ( ) => {
524+ I18n . init ( ) ;
525+ } ) ;
526+
506527 beforeEach ( ( ) => {
507528 toModeStub = sinon . stub ( modeHelpers , 'toMode' ) ;
508529 } ) ;
0 commit comments