Skip to content

Commit

Permalink
feat(Bonus Pagamenti Digitali): [#177187748] Revert unlock the search…
Browse files Browse the repository at this point in the history
… for SIA and ICCREA (for test only) #2865

This reverts commit 8f29540.
  • Loading branch information
fabriziofff authored Mar 3, 2021
1 parent 256bf4b commit 82180af
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 2 deletions.
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

0 comments on commit 82180af

Please sign in to comment.