Skip to content

Commit

Permalink
test: remove unused test
Browse files Browse the repository at this point in the history
  • Loading branch information
Prithpal-Sooriya committed Sep 13, 2024
1 parent 57a722e commit eb4bc37
Showing 1 changed file with 3 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1083,35 +1083,6 @@ describe('user-storage/user-storage-controller - syncInternalAccountsWithUserSto
});

describe('user-storage/user-storage-controller - saveInternalAccountToUserStorage() tests', () => {
it('returns void if UserStorage is not enabled', async () => {
const arrangeMocks = async () => {
return {
messengerMocks: mockUserStorageMessenger(),
};
};

const { messengerMocks } = await arrangeMocks();
const controller = new UserStorageController({
messenger: messengerMocks.messenger,
env: {
isAccountSyncingEnabled: true,
},
getMetaMetricsState: () => true,
state: {
isProfileSyncingEnabled: false,
isProfileSyncingUpdateLoading: false,
},
});

await controller.saveInternalAccountToUserStorage(
MOCK_INTERNAL_ACCOUNTS.ONE[0] as InternalAccount,
);

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

it('returns void if account syncing feature flag is disabled', async () => {
const arrangeMocks = async () => {
return {
Expand Down Expand Up @@ -1336,10 +1307,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 @@ -1417,17 +1384,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 @@ -1444,7 +1403,6 @@ function mockUserStorageMessenger(options?: {
mockAuthPerformSignOut,
mockKeyringAddNewAccount,
mockAccountsUpdateAccountMetadata,
mockAccountsGetAccountByAddress,
mockAccountsListAccounts,
};
}
Expand Down

0 comments on commit eb4bc37

Please sign in to comment.