forked from binary-com/binary-static
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstatic_strings.js
More file actions
32 lines (28 loc) · 931 Bytes
/
static_strings.js
File metadata and controls
32 lines (28 loc) · 931 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const color = require('cli-color');
const expect = require('chai').expect;
const texts_app = require('../js_texts/static_strings_app');
describe('scripts/js_texts/static_strings_app.js', () => {
const all = {};
const duplicates = {};
before(() => {
texts_app.forEach((str) => {
if (all[str]) {
duplicates[str] = (duplicates[str] || 1) + 1;
} else {
all[str] = 1;
}
});
});
it('strings should not be duplicated', () => {
expect(Object.keys(duplicates)).to.have.lengthOf(0);
});
after(() => {
const keys = Object.keys(duplicates);
if (keys.length) {
console.log(color.yellow('\tDuplicates:'));
keys.forEach((key) => {
console.log(color.red('\t -'), color.yellow(`[${duplicates[key]}]`), `'${key}'`);
});
}
});
});