aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2024-12-03 15:04:10 +0100
committersonartech <sonartech@sonarsource.com>2024-12-06 20:03:27 +0000
commit48b3f6a992f1ddfc53c103dd83bbb6019896aa8c (patch)
treec6759241b2750c75fc89af2a1981cb3dc34f1c58 /server/sonar-web/src/main
parentcc118e75f38cc63c727443a3388a70e39a6fb6b6 (diff)
downloadsonarqube-48b3f6a992f1ddfc53c103dd83bbb6019896aa8c.tar.gz
sonarqube-48b3f6a992f1ddfc53c103dd83bbb6019896aa8c.zip
NO-JIRA Fix locale comparison issue in tests
Diffstat (limited to 'server/sonar-web/src/main')
-rw-r--r--server/sonar-web/src/main/js/helpers/l10nBundle.ts2
-rw-r--r--server/sonar-web/src/main/js/sonar-aligned/helpers/__tests__/measures-test.ts2
2 files changed, 2 insertions, 2 deletions
diff --git a/server/sonar-web/src/main/js/helpers/l10nBundle.ts b/server/sonar-web/src/main/js/helpers/l10nBundle.ts
index 8c1ea4b2a1f..9354364fe71 100644
--- a/server/sonar-web/src/main/js/helpers/l10nBundle.ts
+++ b/server/sonar-web/src/main/js/helpers/l10nBundle.ts
@@ -45,7 +45,7 @@ export function getMessages() {
}
export function getCurrentLocale() {
- return getL10nBundleFromCache().locale;
+ return getL10nBundleFromCache().locale ?? DEFAULT_LOCALE;
}
export function getCurrentL10nBundle() {
diff --git a/server/sonar-web/src/main/js/sonar-aligned/helpers/__tests__/measures-test.ts b/server/sonar-web/src/main/js/sonar-aligned/helpers/__tests__/measures-test.ts
index f5ca0dfd212..8cfe648bb77 100644
--- a/server/sonar-web/src/main/js/sonar-aligned/helpers/__tests__/measures-test.ts
+++ b/server/sonar-web/src/main/js/sonar-aligned/helpers/__tests__/measures-test.ts
@@ -32,7 +32,7 @@ const ONE_DAY = HOURS_IN_DAY * ONE_HOUR;
jest.unmock('../../../helpers/l10n');
jest.mock('../../../helpers/l10nBundle', () => ({
- getCurrentLocale: jest.fn().mockReturnValue('us'),
+ getCurrentLocale: jest.fn().mockReturnValue('en'),
getMessages: jest.fn().mockReturnValue({}),
getIntl: jest.fn().mockReturnValue({ formatMessage: jest.fn(({ id }) => `${id}`) }),
}));