File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,35 @@ describe('integration.translated', () => {
27
27
28
28
expect ( scope . getState ( $result ) ) . toBe ( 'valueOne' ) ;
29
29
} ) ;
30
+
31
+ test ( 'supports simple key and language change' , async ( ) => {
32
+ const instance = createInstance ( {
33
+ resources : {
34
+ th : { common : { key : 'valueOne' } } ,
35
+ en : { common : { key : 'valueTwo' } } ,
36
+ } ,
37
+ lng : 'th' ,
38
+ } ) ;
39
+
40
+ const setup = createEvent ( ) ;
41
+
42
+ const { translated, changeLanguageFx } = createI18nextIntegration ( {
43
+ instance,
44
+ setup,
45
+ } ) ;
46
+
47
+ const $result = translated ( 'common:key' ) ;
48
+
49
+ const scope = fork ( ) ;
50
+
51
+ await allSettled ( setup , { scope } ) ;
52
+
53
+ expect ( scope . getState ( $result ) ) . toBe ( 'valueOne' ) ;
54
+
55
+ await allSettled ( changeLanguageFx , { scope, params : 'en' } ) ;
56
+
57
+ expect ( scope . getState ( $result ) ) . toBe ( 'valueTwo' ) ;
58
+ } ) ;
30
59
} ) ;
31
60
32
61
describe ( 'overload: template literal' , ( ) => {
You can’t perform that action at this time.
0 commit comments