Skip to content

Commit 93ab3b4

Browse files
authored
chore: Migrate test fixture to messenger (#6961)
## Explanation A test fixture used by the package `@metamask/profile-sync-controller` has been migrated to use the new `@metamask/messenger` package, in praration for the `Messenger` being removed from `@metamask/base-controller`. ## References Relates to #5626 ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [x] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs), highlighting breaking changes as necessary - [x] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Switches the contact-syncing test fixture to use @metamask/messenger with namespaced Messenger and updated types. > > - **Tests (contact syncing)**: > - Replace `@metamask/base-controller` `Messenger` with `@metamask/messenger` `Messenger` in `__fixtures__/test-utils.ts`. > - Add `MockAnyNamespace` typing and initialize `Messenger` with `MOCK_ANY_NAMESPACE`. > - Update generic types (`ActionConstraint`, `EventConstraint`) and imports to align with `@metamask/messenger` API. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit caf2a47. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent d48cde0 commit 93ab3b4

File tree

1 file changed

+12
-4
lines changed
  • packages/profile-sync-controller/src/controllers/user-storage/contact-syncing/__fixtures__

1 file changed

+12
-4
lines changed

packages/profile-sync-controller/src/controllers/user-storage/contact-syncing/__fixtures__/test-utils.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@ import type {
55
import type {
66
ActionConstraint,
77
EventConstraint,
8-
} from '@metamask/base-controller';
9-
import { Messenger as MessengerImpl } from '@metamask/base-controller';
8+
MockAnyNamespace,
9+
} from '@metamask/messenger';
10+
import {
11+
MOCK_ANY_NAMESPACE,
12+
Messenger as MessengerImpl,
13+
} from '@metamask/messenger';
1014

1115
import { MOCK_LOCAL_CONTACTS } from './mockContacts';
1216

@@ -32,14 +36,18 @@ export function mockUserStorageMessengerForContactSyncing(options?: {
3236
clearEventSubscriptions: unknown;
3337
registerInitialEventPayload: jest.Mock;
3438
};
35-
baseMessenger: MessengerImpl<ActionConstraint, EventConstraint>;
39+
baseMessenger: MessengerImpl<
40+
MockAnyNamespace,
41+
ActionConstraint,
42+
EventConstraint
43+
>;
3644
mockAddressBookList: jest.Mock;
3745
mockAddressBookSet: jest.Mock;
3846
mockAddressBookDelete: jest.Mock;
3947
contactsUpdatedFromSync: AddressBookEntry[]; // Track contacts that were updated via sync
4048
} {
4149
// Start with a fresh messenger mock
42-
const baseMessenger = new MessengerImpl();
50+
const baseMessenger = new MessengerImpl({ namespace: MOCK_ANY_NAMESPACE });
4351

4452
// Contacts that are synced/updated will be stored here for test inspection
4553
const contactsUpdatedFromSync: AddressBookEntry[] = [];

0 commit comments

Comments
 (0)