diff --git a/test/scrypt.test.js b/test/scrypt.test.js index 43e7923..5951c93 100644 --- a/test/scrypt.test.js +++ b/test/scrypt.test.js @@ -230,3 +230,28 @@ describe('verifySync() error cases', function () { checkThrows('') }) }) + +describe('normalization of unicode characters', function () { + it('works, async', async () => { + const angstromChar = '\xC5ngstrom' + const composed = 'A\u030Angstrom' + const withRingAbove = '\u212Bngstrom' + let hash = await scrypt.hash(angstromChar) + const tests = [] + tests.push(scrypt.verify(hash, composed).should.eventually.be.true) + tests.push(scrypt.verify(hash, withRingAbove).should.eventually.be.true) + hash = await scrypt.hash(composed) + tests.push(scrypt.verify(hash, withRingAbove).should.eventually.be.true) + await Promise.all(tests) + }) + it('works, sync', () => { + const angstromChar = '\xC5ngstrom' + const composed = 'A\u030Angstrom' + const withRingAbove = '\u212Bngstrom' + let hash = scrypt.hashSync(angstromChar) + scrypt.verifySync(hash, composed).should.be.true + scrypt.verifySync(hash, withRingAbove).should.be.true + hash = scrypt.hashSync(composed) + scrypt.verifySync(hash, withRingAbove).should.be.true + }) +}) \ No newline at end of file