From ae8e4ba4b975b1c6381fabec08de18cbc190f978 Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 4 Oct 2024 11:54:40 +0200 Subject: [PATCH] chore: refs #7702 fix tests --- .../common/VnChangePassword.spec.js | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/test/vitest/__tests__/components/common/VnChangePassword.spec.js b/test/vitest/__tests__/components/common/VnChangePassword.spec.js index e7a3bdcf7a..f5a967bb50 100644 --- a/test/vitest/__tests__/components/common/VnChangePassword.spec.js +++ b/test/vitest/__tests__/components/common/VnChangePassword.spec.js @@ -50,10 +50,21 @@ describe('VnSmsDialog', () => { ); }); - it('should call submitFn and emit onSubmit when passwords match', async () => { - vm.passwords.newPassword = 'password'; - vm.passwords.repeatPassword = 'password'; - await vm.validate(); - expect(vm.props.submitFn).toHaveBeenCalledWith('password'); + describe('if passwords match', () => { + it('should call submitFn and emit password', async () => { + vm.passwords.newPassword = 'password'; + vm.passwords.repeatPassword = 'password'; + await vm.validate(); + expect(vm.props.submitFn).toHaveBeenCalledWith('password', undefined); + }); + + it('should call submitFn and emit password and old password', async () => { + vm.passwords.newPassword = 'password'; + vm.passwords.repeatPassword = 'password'; + vm.passwords.oldPassword = 'oldPassword'; + + await vm.validate(); + expect(vm.props.submitFn).toHaveBeenCalledWith('password', 'oldPassword'); + }); }); });