Skip to content

Commit b3e4dc8

Browse files
chintankavathiatimowolf
authored andcommitted
test: increase code coverage threshold
1 parent 6571588 commit b3e4dc8

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

karma.shared.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ module.exports.buildConfig = (config, { name, testSuite }) => ({
4949
reporters: [{ type: 'html' }, { type: 'cobertura' }, { type: 'text-summary' }],
5050
check: {
5151
global: {
52-
lines: 70 // TODO: increase once every test is migrated
52+
lines: 90
5353
}
5454
}
5555
},

projects/element-translate-ng/translate/si-no-translate.spec.ts

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import { TestBed } from '@angular/core/testing';
66

77
import { injectSiTranslateService } from './si-translate.inject';
8-
import { SiTranslateService } from './si-translate.service';
8+
import { getBrowserLanguage, SiTranslateService } from './si-translate.service';
99

1010
describe('SiNoTranslate', () => {
1111
let service: SiTranslateService;
@@ -36,4 +36,29 @@ describe('SiNoTranslate', () => {
3636
it('should translate sync', () => {
3737
expect(service.translateSync('VALUE-3')).toBe('VALUE-3');
3838
});
39+
40+
it('should return language code from different browser locales', () => {
41+
// Mock different browser languages
42+
const originalNavigator = window.navigator;
43+
44+
// Test German
45+
Object.defineProperty(window, 'navigator', {
46+
value: { ...originalNavigator, language: 'de-DE' },
47+
writable: true
48+
});
49+
expect(getBrowserLanguage()).toBe('de');
50+
51+
// Test French
52+
Object.defineProperty(window, 'navigator', {
53+
value: { ...originalNavigator, language: 'fr-FR' },
54+
writable: true
55+
});
56+
expect(getBrowserLanguage()).toBe('fr');
57+
58+
// Restore original navigator
59+
Object.defineProperty(window, 'navigator', {
60+
value: originalNavigator,
61+
writable: true
62+
});
63+
});
3964
});

0 commit comments

Comments
 (0)