Skip to content

Commit

Permalink
test: add user-storage to privacy snapshot and update user-storage mocks
Browse files Browse the repository at this point in the history
note - we need to update our library to support generic paths and mock X-Sync data features
  • Loading branch information
Prithpal-Sooriya committed Sep 19, 2024
1 parent 0fcc063 commit ac2fef4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"test:e2e:chrome:multi-provider": "MULTIPROVIDER=true SELENIUM_BROWSER=chrome node test/e2e/run-all.js --multi-provider",
"test:e2e:firefox": "SELENIUM_BROWSER=firefox node test/e2e/run-all.js",
"test:e2e:firefox:flask": "SELENIUM_BROWSER=firefox node test/e2e/run-all.js --build-type flask",
"test:e2e:single": "node test/e2e/run-e2e-test.js",
"test:e2e:single": "ENABLE_MV3=false SELENIUM_BROWSER=chrome node test/e2e/run-e2e-test.js",
"ganache:start": "./development/run-ganache.sh",
"sentry:publish": "node ./development/sentry-publish.js",
"lint": "yarn lint:prettier && yarn lint:eslint && yarn lint:tsc && yarn lint:styles",
Expand Down
3 changes: 2 additions & 1 deletion privacy-snapshot.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,6 @@
"oidc.api.cx.metamask.io",
"price.api.cx.metamask.io",
"token.api.cx.metamask.io",
"client-side-detection.api.cx.metamask.io"
"client-side-detection.api.cx.metamask.io",
"user-storage.api.cx.metamask.io"
]
13 changes: 13 additions & 0 deletions test/e2e/tests/notifications/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,19 @@ export async function mockNotificationServices(server: Mockttp) {
mockAPICall(server, await StorageMocks.getMockUserStorageGetResponse());
mockAPICall(server, await StorageMocks.getMockUserStoragePutResponse());

// TODO - add better mock responses for other Profile Sync features
// (Account Sync, Network Sync, ...)
server
.forGet(/https:\/\/user-storage\.api\.cx\.metamask\.io\/.*/gu)
?.thenCallback(() => ({
statusCode: 404,
}));
server
.forPut(/https:\/\/user-storage\.api\.cx\.metamask\.io\/.*/gu)
?.thenCallback(() => ({
statusCode: 204,
}));

// Notifications
mockAPICall(server, NotificationMocks.getMockFeatureAnnouncementResponse());
mockAPICall(server, NotificationMocks.getMockBatchCreateTriggersResponse());
Expand Down

0 comments on commit ac2fef4

Please sign in to comment.