Skip to content

Commit

Permalink
feat: add user-storage to privacy snapshot and update user-storage mo…
Browse files Browse the repository at this point in the history
…cks (#27292)

note - we need to update our library to support generic paths and mock
X-Sync data features


<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**

This fixes the flaky test for updating the privacy snapshot for
user-storage API.
We also better mock the user-storage API to fail fast when testing
Account-Syncing.

NOTE - we need to update our library to support generic paths, and also
have mock data for testing the X-Syncing features (account syncing,
network syncing, notification syncing, asset syncing).

<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/27292?quickstart=1)

## **Related issues**

Fixes:

## **Manual testing steps**

1. Go to this page...
2.
3.

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **Pre-merge reviewer checklist**

- [x] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [x] I confirm that this PR addresses all acceptance criteria described
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
  • Loading branch information
Prithpal-Sooriya authored Sep 23, 2024
1 parent 23787d8 commit 74c1ee2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
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 74c1ee2

Please sign in to comment.