Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check pin method #513

Merged
merged 16 commits into from
May 15, 2023
Merged
Prev Previous commit
Next Next commit
tests: remove expectation on number of times called
  • Loading branch information
r4mmer committed May 15, 2023
commit 036aba036cd2c20be6a9b13ccc51e1581f412215
26 changes: 5 additions & 21 deletions __tests__/new/hathorwallet.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ test('checkPin', async () => {

checkPinSpy.mockReturnValue(Promise.resolve(true));
await expect(hWallet.checkPin('0000')).resolves.toEqual(true);
expect(checkPinSpy).toHaveBeenCalledTimes(2);
expect(checkPinSpy).toHaveBeenCalledTimes(1);
});

test('checkPassword', async () => {
Expand Down Expand Up @@ -651,32 +651,16 @@ test('checkPinAndPassword', async () => {
checkPinSpy.mockReturnValue(Promise.resolve(false));
checkPasswdSpy.mockReturnValue(Promise.resolve(false));
await expect(hWallet.checkPinAndPassword('0000', 'passwd')).resolves.toEqual(false);
expect(checkPinSpy).toHaveBeenCalledTimes(1);
expect(checkPasswdSpy).toHaveBeenCalledTimes(0);
checkPinSpy.mockClear();
checkPasswdSpy.mockClear();

checkPinSpy.mockReturnValue(Promise.resolve(true));
checkPasswdSpy.mockReturnValue(Promise.resolve(false));
await expect(hWallet.checkPinAndPassword('0000', 'passwd')).resolves.toEqual(false);
expect(checkPinSpy).toHaveBeenCalledTimes(1);
expect(checkPasswdSpy).toHaveBeenCalledTimes(1);
checkPinSpy.mockClear();
checkPasswdSpy.mockClear();

checkPinSpy.mockReturnValue(Promise.resolve(true));
checkPasswdSpy.mockReturnValue(Promise.resolve(true));
await expect(hWallet.checkPinAndPassword('0000', 'passwd')).resolves.toEqual(true);
expect(checkPinSpy).toHaveBeenCalledTimes(1);
expect(checkPasswdSpy).toHaveBeenCalledTimes(1);
checkPinSpy.mockClear();
checkPasswdSpy.mockClear();

checkPinSpy.mockReturnValue(Promise.resolve(false));
checkPasswdSpy.mockReturnValue(Promise.resolve(true));
await expect(hWallet.checkPinAndPassword('0000', 'passwd')).resolves.toEqual(false);
expect(checkPinSpy).toHaveBeenCalledTimes(1);
expect(checkPasswdSpy).toHaveBeenCalledTimes(0);
checkPinSpy.mockClear();
checkPasswdSpy.mockClear();

checkPinSpy.mockReturnValue(Promise.resolve(true));
checkPasswdSpy.mockReturnValue(Promise.resolve(true));
await expect(hWallet.checkPinAndPassword('0000', 'passwd')).resolves.toEqual(true);
});