diff --git a/test/vitest/__tests__/components/common/VnChangePassword.spec.js b/test/vitest/__tests__/components/common/VnChangePassword.spec.js index e7a3bdcf7..f5a967bb5 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'); + }); }); });