Skip to content

Commit fc51da1

Browse files
committed
Add testing states
1 parent 6ad856a commit fc51da1

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

special-pages/pages/new-tab/app/protections/mocks/protections.mock-transport.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ export function protectionsMockTransport() {
8080
const msg = /** @type {any} */ (_msg);
8181
switch (msg.method) {
8282
case 'protections_getData':
83+
// No data. Setting `stats=none` (totalCount = 0) also
84+
// hides CPM stats
8385
if (url.searchParams.get('stats') === 'none') {
8486
dataset.totalCount = 0;
8587
}
@@ -89,6 +91,14 @@ export function protectionsMockTransport() {
8991
if (url.searchParams.get('cpm') === 'true') {
9092
dataset.totalCookiePopUpsBlocked = 22;
9193
}
94+
// CPM = 0 state
95+
if (url.searchParams.get('cpm') === 'none') {
96+
dataset.totalCookiePopUpsBlocked = 0;
97+
}
98+
// CPM disabled state
99+
if (url.searchParams.get('cpm') === 'null') {
100+
dataset.totalCookiePopUpsBlocked = null;
101+
}
92102
// Setting cpm=undefined allows us to see the legacy
93103
// protections report. Useful until all platforms adopt the
94104
// new schema

0 commit comments

Comments
 (0)