Skip to content

Commit

Permalink
fix google auth for pure (#1993)
Browse files Browse the repository at this point in the history
  • Loading branch information
lkowalczyk87 authored Jul 30, 2024
1 parent bd3fdb7 commit a4ebe23
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
15 changes: 15 additions & 0 deletions libs/core/contacts/actions/authorize.action.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ jest.mock("generic-view/store", () => {
googleAuthorize: () =>
({
type: fulfilledAction("generic-imports/google-authorization-process"),
unwrap: jest.fn().mockResolvedValue({
type: fulfilledAction("generic-imports/google-authorization-process"),
}),
} as unknown as jest.Mock),
}
})
Expand All @@ -41,6 +44,18 @@ describe("async `authorize` ", () => {
authorize(Provider.Google) as unknown as AnyAction
)

const actions = mockStore.getActions()

const googleAuthorizeAction = actions.find(
(action) =>
action.type ===
"generic-imports/google-authorization-process/fulfilled"
)

if (googleAuthorizeAction) {
delete googleAuthorizeAction.unwrap
}

expect(mockStore.getActions()).toEqual([
authorize.pending(requestId, Provider.Google),
{
Expand Down
4 changes: 2 additions & 2 deletions libs/core/contacts/actions/authorize.action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ export const authorize = createAsyncThunk<
>(ContactsEvent.Authorize, async (payload, { dispatch }) => {
switch (payload) {
case Provider.Google:
return dispatch(googleAuthorize(Scope.Contacts))
return dispatch(googleAuthorize(Scope.Contacts)).unwrap()
case Provider.Apple:
return undefined
case Provider.Outlook:
return dispatch(outlookAuthorize(OutLookScope.Contacts))
return dispatch(outlookAuthorize(OutLookScope.Contacts)).unwrap()
default:
return undefined
}
Expand Down

0 comments on commit a4ebe23

Please sign in to comment.