From d4d40405bf8e62a3ab9d2442a1837f8f6075b0a0 Mon Sep 17 00:00:00 2001 From: Chris Garrity Date: Mon, 4 May 2020 08:36:59 -0400 Subject: [PATCH] Remove obsolete test Check duplicates was added to prevent errors in the conversion to/from PO files back before we switched to Transifex. See https://github.com/LLK/scratch-www/pull/1150 --- .../check_duplicate_strings.js | 52 ------------------- 1 file changed, 52 deletions(-) delete mode 100644 test/localization-legacy/check_duplicate_strings.js diff --git a/test/localization-legacy/check_duplicate_strings.js b/test/localization-legacy/check_duplicate_strings.js deleted file mode 100644 index 16f7ab71c..000000000 --- a/test/localization-legacy/check_duplicate_strings.js +++ /dev/null @@ -1,52 +0,0 @@ -/* -* Check that there are no duplicate strings in any individual l10n json file. - */ -var path = require('path'); -var fs = require('fs'); -var tap = require('tap'); - -var routes = require('../../src/routes.json'); - -const noDuplicateValues = (idsToCheck, name) => { - let values = {}; - for (const key in idsToCheck) { - if (values.hasOwnProperty(idsToCheck[key])) { - // duplicate values - // return false; - tap.fail(`${name}.${idsToCheck[key]} has duplicates`); - } else { - values[idsToCheck[key]] = key; - } - } - tap.pass(); - // return true; -}; - -tap.test('generalCheckForDuplicates', function (t) { - const ids = require(path.resolve(__dirname, '../../src/l10n.json')); // eslint-disable-line global-require - noDuplicateValues(ids, 'general'); - t.end(); -}); - -for (var v in routes) { - if (typeof routes[v].redirect !== 'undefined') { - continue; - } - var subdir = routes[v].view.split('/'); - subdir.pop(); - var name = routes[v].name; - var uri = path.resolve(__dirname, '../../src/views/' + subdir.join('/') + '/l10n.json'); - try { - var file = fs.readFileSync(uri, 'utf8'); - var ids = JSON.parse(file); - tap.test(name + 'CheckForDuplicates', function (t) { // eslint-disable-line no-loop-func - noDuplicateValues(ids, name); - t.end(); - }); - } catch (err) { - if (err.code !== 'ENOENT') { - // ignore if ENOENT for routes with no l10n file, throw error for anything else - throw err; - } - } -}