-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added lodash Added a test that fails if the number of keys in one language file doesn't match the number in the other. Will spit out the extra keys if it fails.
- Loading branch information
1 parent
c42bb47
commit d66d6ff
Showing
2 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
|
||
import en from "@/plugins/en.json"; | ||
import fr from "@/plugins/fr.json"; | ||
import _ from "lodash"; | ||
|
||
const enKeys = Object.keys(en); | ||
const frKeys = Object.keys(fr); | ||
|
||
describe("i18n", () => { | ||
it("should have identical keys", () => { | ||
const val = _.difference(enKeys, frKeys); | ||
const enIntersection = _.intersection(enKeys, val); | ||
const mek = enIntersection.join("\n") | ||
const frIntersection = _.intersection(frKeys, val); | ||
const mfk = frIntersection.join("\n"); | ||
|
||
console.log(` | ||
extra keys in en.json | ||
${mek} | ||
extra keys in fr.json | ||
${mfk}`); | ||
|
||
expect(Object.keys(val).length).toBe(0); | ||
}); | ||
|
||
|
||
}); |