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

feat(Bonus Pagamenti Digitali): [#177187748] Revert unlock the search for SIA and ICCREA (for test only) #2865

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env.production
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ MYPORTAL_ENABLED=NO
PLAYGROUNDS_ENABLED=YES
# BPD configuration
BPD_ENABLED=YES
BPD_TEST_OVERLAY=YES
BPD_TEST_OVERLAY=NO
PRIVATIVE_ENABLED=NO
# endpoint BPD API
BPD_API_URL_PREFIX=https://prod.cstar.pagopa.it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { loadCoBadgeAbiConfiguration } from "../../store/actions";
import { getCoBadgeAbiConfigurationSelector } from "../../store/reducers/abiConfiguration";
import { onboardingCoBadgeAbiSelectedSelector } from "../../store/reducers/abiSelected";
import CoBadgeChosenBankScreen from "./CoBadgeChosenBankScreen";
import CoBadgeStartKoDisabled from "./ko/CoBadgeStartKoDisabled";
import CoBadgeStartKoUnavailable from "./ko/CoBadgeStartKoUnavailable";
import LoadAbiConfiguration from "./LoadAbiConfiguration";

Expand Down Expand Up @@ -47,14 +48,18 @@ const CoBadgeStartComponent = (props: Props): React.ReactElement => {
}
switch (props.abiSelectedConfiguration.value) {
case StatusEnum.enabled:
case StatusEnum.disabled:
void trackOutput("Enabled", props.maybeAbiSelected);
// Single ABI (bank) screen that allow to start the search
return (
<CoBadgeChosenBankScreen
abi={props.maybeAbiSelected}
testID={"CoBadgeChosenBankScreenSingleBank"}
/>
);
case StatusEnum.disabled:
void trackOutput("Disabled", props.maybeAbiSelected);
// The chosen ABI is disabled (not yet available)
return <CoBadgeStartKoDisabled />;
case StatusEnum.unavailable:
void trackOutput("Unavailable", props.maybeAbiSelected);
// THe chosen ABI is unavailable (technical problems)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@ jest.mock("react-native-share", () => jest.fn());
const configurationFailure = getGenericError(new Error("generic Error"));
const abiTestId = "9876";
const abiTestId2 = "2222";
const abiConfigurationWithoutBankMock: CoBadgeServices = {
ServiceName: {
status: StatusEnum.enabled,
issuers: [{ abi: "1", name: "bankName" }]
}
};
const abiConfigurationDisabled: CoBadgeServices = {
ServiceName: {
status: StatusEnum.disabled,
issuers: [{ abi: abiTestId, name: "bankName" }]
}
};
const abiConfigurationUnavailable: CoBadgeServices = {
ServiceName: {
status: StatusEnum.unavailable,
Expand Down Expand Up @@ -144,7 +156,24 @@ describe("Test behaviour of the CoBadgeStartScreen", () => {
).toBeTruthy();
}
});
it("When receive a configuration without the selected abi, the screen should render CoBadgeStartKoDisabled", () => {
const { store, testComponent } = getInitCoBadgeStartScreen(abiTestId);

store.dispatch(
loadCoBadgeAbiConfiguration.success(abiConfigurationWithoutBankMock)
);
// The user should see the disabled screen when the selected abi is not in the remote configuration
expect(isDisabledScreen(testComponent)).toBe(true);
});
it("When receive a configuration without an abi disabled, the screen should render CoBadgeStartKoDisabled", () => {
const { store, testComponent } = getInitCoBadgeStartScreen(abiTestId);

store.dispatch(
loadCoBadgeAbiConfiguration.success(abiConfigurationDisabled)
);
// The user should see the disabled screen
expect(isDisabledScreen(testComponent)).toBe(true);
});
it("When receive a configuration with an abi unavailable, the screen should render CoBadgeStartKoUnavailable", () => {
const { store, testComponent } = getInitCoBadgeStartScreen(abiTestId);

Expand Down Expand Up @@ -236,6 +265,9 @@ const isAllBankScreen = (component: RenderAPI) =>
const isLoadingScreen = (component: RenderAPI) =>
component.queryByTestId("LoadAbiConfiguration") !== null;

const isDisabledScreen = (component: RenderAPI) =>
component.queryByTestId("CoBadgeStartKoDisabled") !== null;

const isUnavailableScreen = (component: RenderAPI) =>
component.queryByTestId("CoBadgeStartKoUnavailable") !== null;

Expand Down