@@ -3,20 +3,20 @@ import { makeEnMetaJson } from '#scripts/i18n-meta/update-en-meta-json'
33
44describe ( 'Create en.meta.json' , ( ) => {
55 it ( 'should handle an empty en.json file' , ( ) => {
6- const newEnJson = { }
76 const oldEnMetaJson = { }
7+ const newEnJson = { }
88
9- const enMetaJson = makeEnMetaJson ( newEnJson , oldEnMetaJson , 'sha-new-12345' )
9+ const enMetaJson = makeEnMetaJson ( oldEnMetaJson , newEnJson , 'sha-new-12345' )
1010 expect ( enMetaJson ) . toEqual ( { } )
1111 } )
1212
1313 it ( 'should generate en.meta.json correctly for an initial en.json' , ( ) => {
14+ const oldEnMetaJson = { }
1415 const newEnJson = {
1516 tagline : 'npmx - a fast, modern browser for the npm registry' ,
1617 }
17- const oldEnMetaJson = { }
1818
19- const enMetaJson = makeEnMetaJson ( newEnJson , oldEnMetaJson , 'sha-new-12345' )
19+ const enMetaJson = makeEnMetaJson ( oldEnMetaJson , newEnJson , 'sha-new-12345' )
2020 expect ( enMetaJson ) . toEqual ( {
2121 tagline : {
2222 text : 'npmx - a fast, modern browser for the npm registry' ,
@@ -26,11 +26,6 @@ describe('Create en.meta.json', () => {
2626 } )
2727
2828 it ( 'should update existing keys and add new keys with the latest commit hash' , ( ) => {
29- const newEnJson = {
30- name : 'npmx' ,
31- tagline : 'npmx - a fast, modern browser for the npm registry' ,
32- description : 'Search, browse, and explore packages with a modern interface.' ,
33- }
3429 const oldEnMetaJson = {
3530 name : {
3631 text : 'npmx' ,
@@ -41,8 +36,13 @@ describe('Create en.meta.json', () => {
4136 commit : 'sha-old-12345' ,
4237 } ,
4338 }
39+ const newEnJson = {
40+ name : 'npmx' ,
41+ tagline : 'npmx - a fast, modern browser for the npm registry' ,
42+ description : 'Search, browse, and explore packages with a modern interface.' ,
43+ }
4444
45- const enMetaJson = makeEnMetaJson ( newEnJson , oldEnMetaJson , 'sha-new-12345' )
45+ const enMetaJson = makeEnMetaJson ( oldEnMetaJson , newEnJson , 'sha-new-12345' )
4646 expect ( enMetaJson ) . toEqual ( {
4747 name : {
4848 text : 'npmx' ,
@@ -60,18 +60,18 @@ describe('Create en.meta.json', () => {
6060 } )
6161
6262 it ( 'should remove keys that are no longer in en.json' , ( ) => {
63- const newEnJson = {
64- tagline : 'npmx - a fast, modern browser for the npm registry' ,
65- }
6663 const oldEnMetaJson = {
6764 tagline : {
6865 text : 'npmx - a fast, modern browser for the npm registry' ,
6966 commit : 'sha-old-12345' ,
7067 } ,
7168 toBeRemoved : { text : 'This will be gone' , commit : 'sha-old-12345' } ,
7269 }
70+ const newEnJson = {
71+ tagline : 'npmx - a fast, modern browser for the npm registry' ,
72+ }
7373
74- const enMetaJson = makeEnMetaJson ( newEnJson , oldEnMetaJson , 'sha-new-12345' )
74+ const enMetaJson = makeEnMetaJson ( oldEnMetaJson , newEnJson , 'sha-new-12345' )
7575 expect ( enMetaJson ) . toEqual ( {
7676 tagline : {
7777 text : 'npmx - a fast, modern browser for the npm registry' ,
@@ -81,14 +81,6 @@ describe('Create en.meta.json', () => {
8181 } )
8282
8383 it ( 'should handle complex nested structures' , ( ) => {
84- const newEnJson = {
85- a : {
86- b : 'updated-value' ,
87- } ,
88- c : 'value-c' ,
89- d : 'added-value' ,
90- }
91-
9284 const oldEnMetaJson = {
9385 a : {
9486 b : {
@@ -105,8 +97,15 @@ describe('Create en.meta.json', () => {
10597 commit : 'sha-new-12345' ,
10698 } ,
10799 }
100+ const newEnJson = {
101+ a : {
102+ b : 'updated-value' ,
103+ } ,
104+ c : 'value-c' ,
105+ d : 'added-value' ,
106+ }
108107
109- const enMetaJson = makeEnMetaJson ( newEnJson , oldEnMetaJson , 'sha-new-12345' )
108+ const enMetaJson = makeEnMetaJson ( oldEnMetaJson , newEnJson , 'sha-new-12345' )
110109 expect ( enMetaJson ) . toEqual ( {
111110 a : {
112111 b : { text : 'updated-value' , commit : 'sha-new-12345' } ,
0 commit comments