-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathtest.js
33 lines (25 loc) · 872 Bytes
/
test.js
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
33
'use strict';
/* global describe, it */
const assert = require('assert');
const unhomoglyph = require('./');
const data = require('./data.json');
describe('unhomoglyph', function () {
describe('should replace', function () {
Object.keys(data).forEach(key => {
it(`${key} => ${data[key]}`, function () {
assert.strictEqual(unhomoglyph(`${key}`), `${data[key]}`);
});
});
});
it('shoult not touch ordinary strings', function () {
assert.strictEqual(unhomoglyph('abc'), 'abc');
assert.strictEqual(unhomoglyph(''), '');
});
it('should find multiple entries', function () {
assert.strictEqual(unhomoglyph('1abcаа'), 'labcaa');
});
it('2028 & 2029 should be ok after replace in updater', function () {
assert.strictEqual(data['\u2028'], ' ');
assert.strictEqual(data['\u2029'], ' ');
});
});