From 1e3d6855cc73e9dae28fb7a30205b0c4eedf81ec Mon Sep 17 00:00:00 2001 From: wuxinnan Date: Wed, 18 May 2022 10:36:12 -0700 Subject: [PATCH] added test case to check password validity --- .../core/admin/server/services/__tests__/auth.test.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/core/admin/server/services/__tests__/auth.test.js b/packages/core/admin/server/services/__tests__/auth.test.js index 9aa446ae78..f66b0283ba 100644 --- a/packages/core/admin/server/services/__tests__/auth.test.js +++ b/packages/core/admin/server/services/__tests__/auth.test.js @@ -114,6 +114,17 @@ describe('Auth', () => { }); }); + describe('invalidatePassword', () => { + test('Compares password with hash', async () => { + const password = 'pcw123'; + const password2 = 'pcs1234'; + const hash = await hashPassword(password2); + + const isValid = await validatePassword(password, hash); + expect(isValid).toBe(false); + }); + }); + describe('forgotPassword', () => { test('Only run the process for active users', async () => { const findOne = jest.fn(() => Promise.resolve());