Skip to content

Commit 7f51bcd

Browse files
committed
fix(spec): fix tests for config autoupgrader
1 parent 1dbd616 commit 7f51bcd

2 files changed

Lines changed: 13 additions & 5 deletions

File tree

packages/spec/src/config.spec.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,21 +43,26 @@ const createV1_1Config = () => ({
4343
},
4444
});
4545

46+
const createV1_2Config = () => ({
47+
...createV1_1Config(),
48+
version: 1.2,
49+
});
50+
4651
describe('I18n Config Parser', () => {
47-
it('should upgrade v0 config to v1.1', () => {
52+
it('should upgrade v0 config to v1.2', () => {
4853
const v0Config = createV0Config();
4954
const result = parseI18nConfig(v0Config);
5055

51-
expect(result.version).toBe(1.1);
56+
expect(result.version).toBe(1.2);
5257
expect(result.locale).toEqual(defaultConfig.locale);
5358
expect(result.buckets).toEqual({});
5459
});
5560

56-
it('should upgrade v1 config to v1.1', () => {
61+
it('should upgrade v1 config to v1.2', () => {
5762
const v1Config = createV1Config();
5863
const result = parseI18nConfig(v1Config);
5964

60-
expect(result.version).toBe(1.1);
65+
expect(result.version).toBe(1.2);
6166
expect(result.locale).toEqual(v1Config.locale);
6267
expect(result.buckets).toEqual({
6368
json: {

packages/spec/src/config.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,10 @@ export const configV1_2Definition = extendConfigDefinition(configV1_1Definition,
142142
extraSource: allLocalesSchema.optional(),
143143
}),
144144
}),
145-
createDefaultValue: (baseDefaultValue) => baseDefaultValue,
145+
createDefaultValue: (baseDefaultValue) => ({
146+
...baseDefaultValue,
147+
version: 1.2,
148+
}),
146149
createUpgrader: (oldConfig) => ({
147150
...oldConfig,
148151
version: 1.2,

0 commit comments

Comments
 (0)