mirror of
https://github.com/DOI-DO/j40-cejst-2.git
synced 2025-08-06 15:54:19 -07:00
Updates intl file with latest copy (#795)
* Extract 404 page copy to intl * Move all copy to data copy folder and add tests - Add test:intl-extraction script - Fix certain defaultMessages not appearing - update snapshot
This commit is contained in:
parent
a94b8e2761
commit
d1511287b8
11 changed files with 199 additions and 140 deletions
29
client/src/intl/testIntlExtraction.js
Normal file
29
client/src/intl/testIntlExtraction.js
Normal file
|
@ -0,0 +1,29 @@
|
|||
const enJson = require('./en.json');
|
||||
const assert = require('assert');
|
||||
|
||||
// This file will allow us to test the en.json file and see if any entries are missing a default message.
|
||||
// 1. Run intl:extract by npm run intl:extract
|
||||
// 2. Navigate to client folder and in the command line
|
||||
// 3. npm run test:intl-extraction
|
||||
// 4. If there is no errors, then everything looks good!
|
||||
// 5. If there are errors, set debug to true and re-run.
|
||||
|
||||
// Todo: Have this run anytime any copy changes occur
|
||||
|
||||
const debug = false;
|
||||
if (debug) console.log('Total number of entries in en.json file: ', Object.entries(enJson).length);
|
||||
|
||||
let defaultCount = 0;
|
||||
const noDefault = [];
|
||||
Object.entries(enJson).forEach((msg) => msg[1].defaultMessage ? defaultCount++ : noDefault.push(msg[0]));
|
||||
if (debug) console.log('Total number of defaultMessages in en.json file: ', defaultCount);
|
||||
|
||||
noDefault.forEach((msg) => console.log('Entries missing defaultMessage: ', msg));
|
||||
|
||||
let description = 0;
|
||||
Object.entries(enJson).forEach((msg) => msg[1].description ? description++ : null);
|
||||
if (debug) console.log('Total number of descriptions in en.json file: ', description);
|
||||
|
||||
// Assertions will fire on errors:
|
||||
assert(Object.entries(enJson).length === defaultCount);
|
||||
assert(Object.entries(enJson).length === description);
|
Loading…
Add table
Add a link
Reference in a new issue