This repository has been archived on 2018-10-12. You can view files and clone it, but cannot push or open issues or pull requests.
ProgBlog/test/unit/helpers/passwordhash_test.js

23 lines
530 B
JavaScript
Raw Normal View History

'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);
});
});
});