Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: poll only popular network #12658

Open
wants to merge 25 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: fix unit test
salimtb committed Dec 12, 2024
commit 4bb2c3daeb75d72dac558c61a65e419669441202
20 changes: 18 additions & 2 deletions app/selectors/networkController.test.ts
Original file line number Diff line number Diff line change
@@ -111,8 +111,24 @@ describe('networkSelectors', () => {
});

it('selectIsAllNetworks should return false if tokenNetworkFilter length is greater than 1', () => {
const tokenNetworkFilter = { '0x1': 'true' };
expect(selectIsAllNetworks.resultFunc(tokenNetworkFilter)).toBe(false);
expect(
selectIsAllNetworks({
...mockState,
engine: {
...mockState.engine,
backgroundState: {
...mockState.engine.backgroundState,
NetworkController: {
...mockState.engine.backgroundState.NetworkController,
},
PreferencesController: {
...mockState.engine.backgroundState.PreferencesController,
tokenNetworkFilter: { '0x1': 'true' },
},
},
},
}),
).toBe(false);
});

it('selectNetworkConfigurationByChainId should return the network configuration for a given chainId', () => {

Unchanged files with check annotations Beta

}
/*
* With the integration of Expo, it introduced a compatibility layer (https://github.com/expo/vector-icons)

Check warning on line 88 in app/components/UI/Ramp/components/PaymentMethodIcon.tsx

GitHub Actions / scripts (lint)

Trailing spaces not allowed
* around react-native-vector-icons which doesn't expose hasIcon anymore so we need to build our own based on
* the implementation https://github.com/oblador/react-native-vector-icons/blob/master/lib/create-icon-set.js#L158
*/
import { useTheme } from '../../../../../../util/theme';
const OPAQUE_GRAY = '#414141';

Check warning on line 7 in app/components/Views/confirmations/components/UI/BottomModal/BottomModal.tsx

GitHub Actions / scripts (lint)

'#414141' Hex color values are not allowed. Consider using design tokens instead. For support reach out to the design system team #metamask-design-system on Slack
interface BottomModalProps {
children: ReactChild;
onClose?: () => void;
afterEach(() => {
jest.restoreAllMocks();
});

Check warning on line 12 in app/core/Encryptor/pbkdf2.test.ts

GitHub Actions / scripts (lint)

Trailing spaces not allowed
it('uses the native implementation of pbkdf2 with main aes', async () => {
NativeModules.Aes.pbkdf2 = jest
.fn()
const { tokenBalances } = backgroundState.TokenBalancesController;
let tokenFound = false;
tokenLoop: for (const chains of Object.values(tokenBalances)) {

Check warning on line 1879 in app/core/Engine/Engine.ts

GitHub Actions / scripts (lint)

Unexpected labeled statement
for (const tokens of Object.values(chains)) {
for (const balance of Object.values(tokens)) {
if (!isZero(balance)) {
tokenFound = true;
break tokenLoop;

Check warning on line 1884 in app/core/Engine/Engine.ts

GitHub Actions / scripts (lint)

Unexpected label in break statement
}
}
}
expect(message).toBe(strings('notifications.default_message_description'));
});
});

Check warning on line 129 in app/core/NotificationsManager.test.ts

GitHub Actions / scripts (lint)

Trailing spaces not allowed
describe('smartTransactionListener', () => {
const mockTransactionController = {
getTransactions: jest.fn(),
beforeEach(() => {
// Clear all mock interactions before each test
jest.clearAllMocks();

Check warning on line 175 in app/core/NotificationsManager.test.ts

GitHub Actions / scripts (lint)

Trailing spaces not allowed
// Reset the notification manager before each test
notificationManager = NotificationManager.init({
navigation: mockNavigation,
transactionId: '0x123',
};
notificationManager.watchSubmittedTransaction({

Check warning on line 200 in app/core/NotificationsManager.test.ts

GitHub Actions / scripts (lint)

Trailing spaces not allowed
id: '0x123',
txParams: {
nonce: '0x1'
},
silent: false
});

Check warning on line 207 in app/core/NotificationsManager.test.ts

GitHub Actions / scripts (lint)

Trailing spaces not allowed
// Get the subscriber callback
const subscriberCallback = mockControllerMessenger.subscribe.mock.calls[0][1];
await subscriberCallback(transaction);
});
it('shows a cancelled notification for cancelled smart transactions', async () => {
const mockTransaction = {

Check warning on line 220 in app/core/NotificationsManager.test.ts

GitHub Actions / scripts (lint)

Trailing spaces not allowed
id: '0x123',
txParams: {
nonce: '0x1'