Skip to content

Commit

Permalink
PWA-3230::merged code for pwa-3214
Browse files Browse the repository at this point in the history
  • Loading branch information
glo82145 committed Jan 29, 2024
1 parent 16a128c commit af41128
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions packages/peregrine/lib/talons/SignIn/__tests__/useSignIn.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { useSignIn } from '../useSignIn';
import { useEventingContext } from '../../../context/eventing';
import { useAwaitQuery } from '../../../hooks/useAwaitQuery';


jest.mock('@apollo/client', () => {
return {
...jest.requireActual('@apollo/client'),
Expand Down Expand Up @@ -127,7 +126,6 @@ test('returns correct shape', () => {
"handleCreateAccount": [Function],
"handleEnterKeyPress": [Function],
"handleForgotPassword": [Function],
"forgotPasswordHandleEnterKeyPress": [Function],
"handleSubmit": [Function],
"isBusy": true,
"recaptchaWidgetProps": Object {
Expand Down Expand Up @@ -202,26 +200,17 @@ test('handleForgotPassword triggers callbacks', () => {
expect(initialProps.showForgotPassword).toHaveBeenCalled();
});


test('forgotPasswordHandleEnterKeyPress triggers callbacks on click', () => {


var event = new KeyboardEvent('keydown', {'keyCode': 37});
document.dispatchEvent(event);
const mockUsername = 'fry@planetexpress.com';
const mockApi = {
getValue: jest.fn().mockReturnValue(mockUsername)
};

var event = new KeyboardEvent('keydown', { keyCode: 13 });
document.dispatchEvent(event);

const { result } = renderHookWithProviders();
act(() => result.current.setFormApi(mockApi));
act(() => result.current.forgotPasswordHandleEnterKeyPress());

expect(initialProps.setDefaultUsername).toHaveBeenCalledWith(mockUsername);
expect(initialProps.showForgotPassword).toHaveBeenCalled();
// }
// expect(onSelection).toHaveBeenCalledWith(66);

});

test('handleCreateAccount triggers callbacks', () => {
Expand Down

0 comments on commit af41128

Please sign in to comment.