From 1caac515e78a1b5ec1d1f911efb7735eb4c6e15b Mon Sep 17 00:00:00 2001 From: alxndrsn Date: Mon, 27 Apr 2026 12:09:00 +0000 Subject: [PATCH] test/unit/util/crypto: split tests for hash & verify * previously `hashPassword()` and `verifyPassword()` were included in the same `describe()` block * in ea188f4ec8ba932d1263fc1eaabe0e4eb862e19b, one test for verify was mistakenly changed to hash --- test/unit/util/crypto.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/test/unit/util/crypto.js b/test/unit/util/crypto.js index f0e0a102c..a9e0a61e5 100644 --- a/test/unit/util/crypto.js +++ b/test/unit/util/crypto.js @@ -7,8 +7,8 @@ const streamTest = require('streamtest').v2; const crypto = require(appRoot + '/lib/util/crypto'); describe('util/crypto', () => { - describe('hashPassword/verifyPassword', () => { - const { hashPassword, verifyPassword } = crypto; + describe('hashPassword()', () => { + const { hashPassword } = crypto; // we do not actually verify the hashing itself, as: // 1. it is entirely performed by bcrypt, which has is own tests. @@ -17,11 +17,18 @@ describe('util/crypto', () => { it('should always return a Promise', () => { hashPassword('').should.be.a.Promise(); hashPassword('password').should.be.a.Promise(); - hashPassword('password', 'hashhash').should.be.a.Promise(); }); it('should reject given a blank plaintext', () => hashPassword('').should.be.rejectedWith('The password or passphrase provided does not meet the required length.')); + }); + + describe('verifyPassword()', () => { + const { verifyPassword } = crypto; + + it('should always return a Promise', () => { + verifyPassword('password', 'hashhash').should.be.a.Promise(); + }); it('should not attempt to verify empty plaintext', (done) => { verifyPassword('', '$2a$12$hCRUXz/7Hx2iKPLCduvrWugC5Q/j5e3bX9KvaYvaIvg/uvFYEpzSy').then((result) => {