Skip to content

Commit 0d13311

Browse files
committed
chore: fix i18nBundle test
1 parent 6e8f522 commit 0d13311

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

packages/base/src/hooks/use18nBundle.test.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
import { act, renderHook } from '@testing-library/react-hooks';
22
import { useI18nBundle } from './useI18nBundle';
3-
import { setLanguage } from '@ui5/webcomponents-base/dist/config/Language.js';
3+
import { setLanguage, setFetchDefaultLanguage } from '@ui5/webcomponents-base/dist/config/Language.js';
44
import { version as reactVersion } from 'react/package.json';
55
import { fetchI18nBundle } from '@ui5/webcomponents-base/dist/i18nBundle';
66

77
describe('useI18nBundle', () => {
8+
beforeAll(() => {
9+
setFetchDefaultLanguage(true);
10+
});
11+
12+
afterAll(() => {
13+
setFetchDefaultLanguage(false);
14+
});
15+
816
test('Should load message bundle and update', async () => {
917
if (reactVersion === '16.8.0') {
1018
// not testable with 16.8.0

packages/base/src/hooks/useI18nBundle.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export const useI18nBundle = (bundleName: string): I18nBundle => {
1515

1616
useIsomorphicLayoutEffect(() => {
1717
let isMounted = true;
18-
const i18nBundleData = getI18nBundleData('@ui5/webcomponents-react');
18+
const i18nBundleData = getI18nBundleData(bundleName);
1919
if (!i18nBundleData) {
2020
fetchI18nBundle(`${bundleName}`).then(() => {
2121
if (isMounted) {

0 commit comments

Comments
 (0)