mirror of
https://github.com/litruv/unhomoglyph.git
synced 2026-07-24 02:36:12 +10:00
first commit
This commit is contained in:
29
test.js
Normal file
29
test.js
Normal file
@@ -0,0 +1,29 @@
|
||||
'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');
|
||||
});
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user