-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(Bonus Pagamenti Digitali): [#176143732] refresh wallet informatio…
…n before start the bpd onboarding (#2626) * [#176143732] dispatch fetchWalletsRequest action before start the bpd onboarding * [#176143732] add test * [#176143732] fix lint error Co-authored-by: Matteo Boschi <[email protected]> Co-authored-by: fabriziofff <[email protected]>
- Loading branch information
1 parent
1495859
commit 15c074d
Showing
2 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
ts/features/bonus/bpd/saga/__tests__/onboarding/startOnboarding.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { testSaga } from "redux-saga-test-plan"; | ||
import { some } from "fp-ts/lib/Option"; | ||
import { right } from "fp-ts/lib/Either"; | ||
import { navigationCurrentRouteSelector } from "../../../../../../store/reducers/navigation"; | ||
import { | ||
bpdStartOnboardingWorker, | ||
isBpdEnabled | ||
} from "../../orchestration/onboarding/startOnboarding"; | ||
import { | ||
navigateToBpdOnboardingDeclaration, | ||
navigateToBpdOnboardingInformationTos, | ||
navigateToBpdOnboardingLoadActivationStatus | ||
} from "../../../navigation/actions"; | ||
import { navigationHistoryPop } from "../../../../../../store/actions/navigationHistory"; | ||
import { | ||
bpdOnboardingAcceptDeclaration, | ||
bpdUserActivate | ||
} from "../../../store/actions/onboarding"; | ||
import { fetchWalletsRequest } from "../../../../../../store/actions/wallet/wallets"; | ||
|
||
jest.mock("react-native-share", () => ({ | ||
open: jest.fn() | ||
})); | ||
|
||
describe("bpdStartOnboardingWorker", () => { | ||
it("should onboard a user", () => { | ||
const notLoadingScreenRoute = "NotLoadingScreenRoute"; | ||
|
||
testSaga(bpdStartOnboardingWorker) | ||
.next() | ||
.select(navigationCurrentRouteSelector) | ||
.next(some(notLoadingScreenRoute)) | ||
.put(navigateToBpdOnboardingLoadActivationStatus()) | ||
.next() | ||
.put(navigationHistoryPop(1)) | ||
.next() | ||
.call(isBpdEnabled) | ||
.next(right(true)) | ||
.put(fetchWalletsRequest()) | ||
.next() | ||
.put(navigateToBpdOnboardingInformationTos()) | ||
.next() | ||
.put(navigationHistoryPop(1)) | ||
.next() | ||
.take(bpdUserActivate) | ||
.next() | ||
.put(navigateToBpdOnboardingDeclaration()) | ||
.next() | ||
.put(navigationHistoryPop(1)) | ||
.next() | ||
.take(bpdOnboardingAcceptDeclaration); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters