11import { expect , test } from 'vitest'
22
3- import en from "../../locale/en" ;
4- import nl from "../../locale/nl" ;
3+ import en from "../../locale/en.js" ;
4+ import nl from "../../locale/nl.js" ;
5+ import { isEmpty } from "../../utils/Utils.js" ;
56
67expect . extend ( {
78 toContainKey ( translation , key ) {
@@ -13,20 +14,22 @@ expect.extend({
1314} ) ;
1415
1516test ( "All translations exists in all bundles" , ( ) => {
16- const disabledTest = true ;
17+ const disabledTest = false ;
1718 //For now disable this, enable again when translations are more final
1819 if ( disabledTest ) {
1920 return ;
2021 }
2122 const contains = ( translation , translationToVerify , keyCollection , parents ) => {
22- Object . keys ( translation ) . forEach ( key => {
23- expect ( translationToVerify ) . toContainKey ( key ) ;
24- const value = translation [ key ] ;
25- keyCollection . push ( parents + key ) ;
26- if ( typeof value === "object" ) {
27- contains ( value , translationToVerify [ key ] , keyCollection , parents + key + "." )
28- }
29- } ) ;
23+ if ( ! isEmpty ( translation ) ) {
24+ Object . keys ( translation ) . forEach ( key => {
25+ expect ( translationToVerify ) . toContainKey ( key ) ;
26+ const value = translation [ key ] ;
27+ keyCollection . push ( parents + key ) ;
28+ if ( typeof value === "object" ) {
29+ contains ( value , translationToVerify [ key ] , keyCollection , parents + key + "." )
30+ }
31+ } ) ;
32+ }
3033 } ;
3134 const keyCollectionEN = [ ] ;
3235 contains ( en , nl , keyCollectionEN , '' ) ;
0 commit comments