Skip to content

Commit

Permalink
test: remove unused test (#4703)
Browse files Browse the repository at this point in the history
## Explanation

We have a mock and a test that is not used anymore. It still passed the
CI, but actually doesn't test anything.

## References

<!--
Are there any issues that this pull request is tied to? Are there other
links that reviewers should consult to understand these changes better?

For example:

* Fixes #12345
* Related to #67890
-->

## Changelog

### `@metamask/profile-sync-controller`

- **REMOVED**: unused mock function.

## 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 highlighted breaking changes using the "BREAKING" category
above as appropriate
  • Loading branch information
Prithpal-Sooriya committed Sep 16, 2024
1 parent 4d30dda commit 2fe4b0b
Showing 1 changed file with 10 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
MOCK_STORAGE_KEY,
MOCK_STORAGE_KEY_SIGNATURE,
} from './__fixtures__/mockStorage';
import * as AccountsUserStorageModule from './accounts/user-storage';
import encryption from './encryption/encryption';
import type {
GetUserStorageAllFeatureEntriesResponse,
Expand Down Expand Up @@ -1185,6 +1186,11 @@ describe('user-storage/user-storage-controller - saveInternalAccountToUserStorag
};
};

const mapInternalAccountToUserStorageAccountMock = jest.spyOn(
AccountsUserStorageModule,
'mapInternalAccountToUserStorageAccount',
);

const { messengerMocks } = await arrangeMocks();
const controller = new UserStorageController({
messenger: messengerMocks.messenger,
Expand All @@ -1202,9 +1208,7 @@ describe('user-storage/user-storage-controller - saveInternalAccountToUserStorag
MOCK_INTERNAL_ACCOUNTS.ONE[0] as InternalAccount,
);

expect(
messengerMocks.mockAccountsGetAccountByAddress,
).not.toHaveBeenCalled();
expect(mapInternalAccountToUserStorageAccountMock).not.toHaveBeenCalled();
});

it('returns void if account syncing feature flag is disabled', async () => {
Expand Down Expand Up @@ -1431,10 +1435,6 @@ function mockUserStorageMessenger(options?: {

const mockAccountsUpdateAccountMetadata = jest.fn().mockResolvedValue(true);

const mockAccountsGetAccountByAddress = jest
.fn()
.mockResolvedValue(MOCK_INTERNAL_ACCOUNTS.ONE[0]);

jest.spyOn(messenger, 'call').mockImplementation((...args) => {
// Creates the correct typed call params for mocks
type CallParams = {
Expand Down Expand Up @@ -1512,17 +1512,9 @@ function mockUserStorageMessenger(options?: {
return mockAccountsUpdateAccountMetadata(args.slice(1));
}

if (actionType === 'AccountsController:getAccountByAddress') {
return mockAccountsGetAccountByAddress();
}

const exhaustedMessengerMocks = (action: never) => {
throw new Error(
`MOCK_FAIL - unsupported messenger call: ${action as string}`,
);
};

return exhaustedMessengerMocks(actionType);
throw new Error(
`MOCK_FAIL - unsupported messenger call: ${actionType as string}`,
);
});

return {
Expand All @@ -1539,7 +1531,6 @@ function mockUserStorageMessenger(options?: {
mockAuthPerformSignOut,
mockKeyringAddNewAccount,
mockAccountsUpdateAccountMetadata,
mockAccountsGetAccountByAddress,
mockAccountsListAccounts,
};
}
Expand Down

0 comments on commit 2fe4b0b

Please sign in to comment.