Files
unhomoglyph/test.js
Vitaly Puzrin 0897ce4316 first commit
2016-12-09 12:28:08 +03:00

30 lines
704 B
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
'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');
});
});