Skip to content

Commit 09eaab6

Browse files
authored
MNTOR-4943 - Support scan results without exposure data (#6103)
* MNTOR-4943 - Support scan results without exposure data * add unit test
1 parent 4849208 commit 09eaab6

File tree

4 files changed

+63
-7
lines changed

4 files changed

+63
-7
lines changed

locales-pending/dashboard-premium.ftl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ exposure-card-description-info-for-sale-fixed = As a { -brand-monitor-plus } mem
211211
exposure-card-description-info-for-sale-fixed-manually-fixed = You marked this profile as fixed. Be sure you’ve followed all instructions on <data_broker_profile>the site</data_broker_profile> to ensure they remove your personal info.
212212
exposure-card-description-info-for-sale-fixed-removal-under-maintenance-manually-fixed = You marked <data_broker_profile>this profile</data_broker_profile> as resolved. You could be added back in the future, so { -brand-monitor } will continue to scan data broker sites for new exposures.
213213
exposure-card-description-info-for-sale-manual-removal-needed = We’ve asked this data broker to remove your profile but they haven’t done it. To start the process sooner, we can guide you step-by-step to manually remove your profile and resolve any exposures. Select <b>Resolve exposures</b> to get started.
214+
exposure-card-description-no-exposures-found = This site only exposed your name; no other personal information was found.
214215
215216
## Manual Removal Data Broker
216217

src/app/components/client/exposure_card/ExposureCard.stories.tsx

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
} from "../../../../apiMocks/mockData";
1313
import { defaultExperimentData } from "../../../../telemetry/generated/nimbus/experiments";
1414
import { BreachDataTypes } from "../../../functions/universal/breach";
15+
import { OnerepScanResultDataBrokerRow } from "knex/types/tables";
1516

1617
const meta: Meta<typeof ExposureCard> = {
1718
title: "Dashboard/Exposures/Exposure Card",
@@ -50,12 +51,35 @@ const ScanMockItemInProgress = createRandomOnerepScanResult({
5051
status: "optout_in_progress",
5152
manually_resolved: false,
5253
});
53-
5454
const ScanMockItemRemovalUnderMaintenance = createRandomOnerepScanResult({
5555
status: "optout_in_progress",
5656
manually_resolved: false,
5757
broker_status: "removal_under_maintenance",
5858
});
59+
const ScanMockItemNoExposureData: OnerepScanResultDataBrokerRow = {
60+
id: 0,
61+
onerep_scan_result_id: 123,
62+
onerep_scan_id: 123,
63+
first_name: "John",
64+
last_name: "Doe",
65+
middle_name: "",
66+
age: 20,
67+
status: "new",
68+
manually_resolved: false,
69+
phones: [],
70+
emails: [],
71+
relatives: [],
72+
link: "link.com",
73+
data_broker: "randomdatabroke.com",
74+
data_broker_id: 100,
75+
created_at: new Date(),
76+
updated_at: new Date(),
77+
optout_attempts: 0,
78+
broker_status: "active",
79+
scan_result_status: "new",
80+
url: "url",
81+
addresses: [],
82+
};
5983

6084
const ScanMockItemRemovalUnderMaintenanceManuallyFixed =
6185
createRandomOnerepScanResult({
@@ -93,6 +117,13 @@ export const DataBrokerRequestedRemoval: Story = {
93117
},
94118
};
95119

120+
export const DataBrokerActionNeededNoExposureResults: Story = {
121+
args: {
122+
exposureImg: FamilyTreeImage,
123+
exposureData: ScanMockItemNoExposureData,
124+
},
125+
};
126+
96127
export const DataBrokerActionNeeded: Story = {
97128
args: {
98129
exposureImg: FamilyTreeImage,

src/app/components/client/exposure_card/ExposureCard.test.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import Meta, {
1818
DataBrokerRemovalUnderMaintenance,
1919
DataBrokerRemovalUnderMaintenanceFixed,
2020
DataBrokerRemovalUnderMaintenanceAutomaticallyRemoved,
21+
DataBrokerActionNeededNoExposureResults,
2122
} from "./ExposureCard.stories";
2223
import { isDataBrokerUnderMaintenance } from "../../../(proper_react)/(redesign)/(authenticated)/user/(dashboard)/dashboard/View";
2324
import { createRandomOnerepScanResult } from "../../../../apiMocks/mockData";
@@ -42,6 +43,19 @@ it("passes the axe accessibility test suite", async () => {
4243
}, 10_000);
4344

4445
describe("ScanResultCard", () => {
46+
// No exposure results down
47+
it("shows the alternative string for when exposure results are empty", () => {
48+
const ComposedProgressCard = composeStory(
49+
DataBrokerActionNeededNoExposureResults,
50+
Meta,
51+
);
52+
render(<ComposedProgressCard />);
53+
const innerDescription = screen.getByText(
54+
"This site only exposed your name; no other personal information was found.",
55+
);
56+
expect(innerDescription).toBeInTheDocument();
57+
});
58+
4559
// Data broker action needed
4660
it("shows the right description for a scan result card where there is action needed", () => {
4761
const ComposedProgressCard = composeStory(DataBrokerActionNeeded, Meta);

src/app/components/client/exposure_card/ScanResultCard.tsx

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,12 @@ export const ScanResultCard = (props: ScanResultCardProps) => {
277277
}
278278
})();
279279

280+
const noExposureDataFound =
281+
scanResult.phones.length === 0 &&
282+
scanResult.relatives.length === 0 &&
283+
scanResult.addresses.length === 0 &&
284+
scanResult.emails.length === 0;
285+
280286
const exposureCard = (
281287
<div aria-label={props.scanResult.data_broker}>
282288
<div className={styles.exposureCard}>
@@ -379,13 +385,17 @@ export const ScanResultCard = (props: ScanResultCardProps) => {
379385
</div>
380386
<div className={styles.exposureDetailsContent}>
381387
<p className={styles.exposedInfoTitle}>
382-
{l10n.getString("exposure-card-found-the-following-data")}
388+
{noExposureDataFound
389+
? l10n.getString("exposure-card-description-no-exposures-found")
390+
: l10n.getString("exposure-card-found-the-following-data")}
383391
</p>
384-
<div className={styles.exposedDataTypes}>
385-
{exposureCategoriesArray.map((item) => (
386-
<React.Fragment key={item.key}>{item}</React.Fragment>
387-
))}
388-
</div>
392+
{!noExposureDataFound && (
393+
<div className={styles.exposedDataTypes}>
394+
{exposureCategoriesArray.map((item) => (
395+
<React.Fragment key={item.key}>{item}</React.Fragment>
396+
))}
397+
</div>
398+
)}
389399
</div>
390400
<span className={styles.resolveExposuresCtaMobile}>
391401
{resolveExposuresCta}

0 commit comments

Comments
 (0)