Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 4ab2433

Browse files
committed
[WIP] port i18n/spec/utilSpec.js to i18n/spec/closureI18nExtractorSpec.js
1 parent e27461f commit 4ab2433

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

i18n/spec/closureI18nExtractorSpec.js

+16-8
Original file line numberDiff line numberDiff line change
@@ -61,21 +61,29 @@ function newTestLocaleInfo() {
6161
}
6262

6363

64-
describe("findLocaleId", function() {
65-
it("should find the id from numbers", function() {
66-
expect(findLocaleId("NumberFormatSymbols_en_GB", "num")).toEqual("en_GB");
64+
describe('findLocaleId', function() {
65+
it('should find the id from numbers', function() {
66+
expect(findLocaleId('NumberFormatSymbols_en_GB', 'num')).toEqual('en_GB');
6767
});
6868

6969

70-
it("should find the id from datetime", function() {
71-
expect(findLocaleId("DateTimeSymbols_en_ISO", "datetime")).toEqual("en_ISO");
70+
it('should find the id from datetime', function() {
71+
expect(findLocaleId('DateTimeSymbols_en', 'datetime')).toBe('en');
72+
expect(findLocaleId('DateTimeSymbols_en_ISO', 'datetime')).toEqual('en_ISO');
7273
});
7374

75+
it('should not find localeId if data is missing', function() {
76+
expect(findLocaleId('', 'num')).toBeUndefined();
77+
expect(findLocaleId('aa', 'datetime')).toBeUndefined();
78+
expect(findLocaleId('aa', 'randomType')).toBeUndefined();
79+
expect(findLocaleId('NumberFormatSymbols_en', 'datetime')).toBeUndefined();
80+
expect(findLocaleId('DateTimeSymbols_en', 'num')).toBeUndefined();
81+
});
7482

75-
it("should throw an error otherwise", function() {
83+
it('should throw an error otherwise', function() {
7684
expect(function() {
77-
findLocaleId("str", "otherwise");
78-
}).toThrowError("unknown type in findLocaleId: otherwise");
85+
findLocaleId('str', 'otherwise');
86+
}).toThrowError('unknown type in findLocaleId: otherwise');
7987
});
8088
});
8189

0 commit comments

Comments
 (0)