23 lines
530 B
JavaScript
23 lines
530 B
JavaScript
'use strict';
|
|
|
|
const testBase = require('../../test-base');
|
|
const expect = testBase.expect;
|
|
const hasher = testBase.require('app/helpers/password-hash');
|
|
|
|
let raw = 'password';
|
|
let hash = '';
|
|
|
|
hasher.hash(raw).then((newHash) => {
|
|
suite('Scrypt password hashing tests', () => {
|
|
hash = newHash;
|
|
test('Created a hash', () => {
|
|
expect(hash).to.be.ok;
|
|
});
|
|
test('Hash matches password', (done) => {
|
|
hasher.verify(hash, raw).then((matches) => {
|
|
expect(matches).to.be.true;
|
|
done();
|
|
}).catch(done);
|
|
});
|
|
});
|
|
}); |