@@ -42,6 +42,17 @@ const createV1_2Config = () => ({
4242 version : 1.2 ,
4343} ) ;
4444
45+ const createV1_3Config = ( ) => ( {
46+ ...createV1_2Config ( ) ,
47+ version : 1.3 ,
48+ } ) ;
49+
50+ const createV1_4Config = ( ) => ( {
51+ ...createV1_3Config ( ) ,
52+ version : 1.4 ,
53+ $schema : "https://lingo.dev/schema/i18n.json" ,
54+ } ) ;
55+
4556const createInvalidLocaleConfig = ( ) => ( {
4657 version : 1 ,
4758 locale : {
@@ -55,20 +66,22 @@ const createInvalidLocaleConfig = () => ({
5566} ) ;
5667
5768describe ( "I18n Config Parser" , ( ) => {
58- it ( "should upgrade v0 config to v1.2 " , ( ) => {
69+ it ( "should upgrade v0 config to latest version " , ( ) => {
5970 const v0Config = createV0Config ( ) ;
6071 const result = parseI18nConfig ( v0Config ) ;
6172
62- expect ( result . version ) . toBe ( 1.3 ) ;
73+ expect ( result [ "$schema" ] ) . toBeDefined ( ) ;
74+ expect ( result . version ) . toBe ( 1.4 ) ;
6375 expect ( result . locale ) . toEqual ( defaultConfig . locale ) ;
6476 expect ( result . buckets ) . toEqual ( { } ) ;
6577 } ) ;
6678
67- it ( "should upgrade v1 config to v1.2 " , ( ) => {
79+ it ( "should upgrade v1 config to latest version " , ( ) => {
6880 const v1Config = createV1Config ( ) ;
6981 const result = parseI18nConfig ( v1Config ) ;
7082
71- expect ( result . version ) . toBe ( 1.3 ) ;
83+ expect ( result [ "$schema" ] ) . toBeDefined ( ) ;
84+ expect ( result . version ) . toBe ( 1.4 ) ;
7285 expect ( result . locale ) . toEqual ( v1Config . locale ) ;
7386 expect ( result . buckets ) . toEqual ( {
7487 json : {
@@ -80,13 +93,6 @@ describe("I18n Config Parser", () => {
8093 } ) ;
8194 } ) ;
8295
83- it ( "should not modify v1.1 config" , ( ) => {
84- const v1_1Config = createV1_1Config ( ) ;
85- const result = parseI18nConfig ( v1_1Config ) ;
86-
87- expect ( result ) . toEqual ( v1_1Config ) ;
88- } ) ;
89-
9096 it ( "should throw an error for invalid configurations" , ( ) => {
9197 const invalidConfig = { version : "invalid" } ;
9298 expect ( ( ) => parseI18nConfig ( invalidConfig ) ) . toThrow ( "Failed to parse config" ) ;
@@ -101,13 +107,13 @@ describe("I18n Config Parser", () => {
101107
102108 it ( "should ignore extra fields in the config" , ( ) => {
103109 const configWithExtra = {
104- ...createV1_1Config ( ) ,
110+ ...createV1_4Config ( ) ,
105111 extraField : "should be ignored" ,
106112 } ;
107113 const result = parseI18nConfig ( configWithExtra ) ;
108114
109115 expect ( result ) . not . toHaveProperty ( "extraField" ) ;
110- expect ( result ) . toEqual ( createV1_1Config ( ) ) ;
116+ expect ( result ) . toEqual ( createV1_4Config ( ) ) ;
111117 } ) ;
112118
113119 it ( "should throw an error for unsupported locales" , ( ) => {
0 commit comments