Skip to content

Commit 87237ce

Browse files
authored
test/unit/util/crypto: split tests for hash & verify (#1819)
* previously `hashPassword()` and `verifyPassword()` were included in the same `describe()` block * in ea188f4, one test for verify was mistakenly changed to hash
1 parent a2ff0e2 commit 87237ce

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

test/unit/util/crypto.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ const streamTest = require('streamtest').v2;
77
const crypto = require(appRoot + '/lib/util/crypto');
88

99
describe('util/crypto', () => {
10-
describe('hashPassword/verifyPassword', () => {
11-
const { hashPassword, verifyPassword } = crypto;
10+
describe('hashPassword()', () => {
11+
const { hashPassword } = crypto;
1212

1313
// we do not actually verify the hashing itself, as:
1414
// 1. it is entirely performed by bcrypt, which has is own tests.
@@ -17,11 +17,18 @@ describe('util/crypto', () => {
1717
it('should always return a Promise', () => {
1818
hashPassword('').should.be.a.Promise();
1919
hashPassword('password').should.be.a.Promise();
20-
hashPassword('password', 'hashhash').should.be.a.Promise();
2120
});
2221

2322
it('should reject given a blank plaintext', () =>
2423
hashPassword('').should.be.rejectedWith('The password or passphrase provided does not meet the required length.'));
24+
});
25+
26+
describe('verifyPassword()', () => {
27+
const { verifyPassword } = crypto;
28+
29+
it('should always return a Promise', () => {
30+
verifyPassword('password', 'hashhash').should.be.a.Promise();
31+
});
2532

2633
it('should not attempt to verify empty plaintext', (done) => {
2734
verifyPassword('', '$2a$12$hCRUXz/7Hx2iKPLCduvrWugC5Q/j5e3bX9KvaYvaIvg/uvFYEpzSy').then((result) => {

0 commit comments

Comments
 (0)