Skip to content

Commit f20c4eb

Browse files
committed
【fix】UT
1 parent 3fdb51a commit f20c4eb

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

test/common/lang/LangSpec.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { Lang } from '../../../src/common/lang/Lang';
2+
3+
describe('Lang', () => {
4+
const originCookie = window.document.cookie;
5+
afterAll(() => {
6+
window.document.cookie = originCookie;
7+
});
8+
afterEach(() => {
9+
Lang.code = null;
10+
});
11+
it('getLang_nocookie', () => {
12+
window.document.cookie = '';
13+
expect(Lang.getCode()).toBe('zh-CN');
14+
});
15+
it('getLang_zh-CN', () => {
16+
window.document.cookie = 'language=en-US';
17+
expect(Lang.getCode()).toBe('en-US');
18+
});
19+
it('getLang_zh', () => {
20+
window.document.cookie = 'language=zh';
21+
expect(Lang.getCode()).toBe('zh-CN');
22+
});
23+
});

0 commit comments

Comments
 (0)