Skip to content

Commit

Permalink
fix: fix linea ticker (#25436)
Browse files Browse the repository at this point in the history
<!--
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**
Linea mainnet ticker should not be undefined.
<!--
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/25436?quickstart=1)

## **Related issues**

Fixes:

## **Manual testing steps**

1. Go to network selector and choose lieann
2. Go back to the wallet page
3. scam warning is displayed for Linea mainnet because ticker is
undefined

## **Screenshots/Recordings**

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

### **Before**
![Screenshot 2024-06-20 at 13 14
37](https://github.com/MetaMask/metamask-extension/assets/26223211/a9a6dc6f-1dc3-4abe-a5df-f239e1a9420a)


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

### **After**

![Screenshot 2024-06-20 at 13 13
22](https://github.com/MetaMask/metamask-extension/assets/26223211/42fcde95-3ccf-453c-b794-f89cda4d395c)

## **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**

- [ ] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [ ] 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
salimtb authored Jun 20, 2024
1 parent e29ed39 commit 9e810ee
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ui/selectors/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ export const getNonTestNetworks = createDeepEqualSelector(
imageUrl: LINEA_MAINNET_TOKEN_IMAGE_URL,
},
providerType: NETWORK_TYPES.LINEA_MAINNET,
ticker: TEST_NETWORK_TICKER_MAP[NETWORK_TYPES.LINEA_MAINNET],
ticker: CURRENCY_SYMBOLS.ETH,
id: NETWORK_TYPES.LINEA_MAINNET,
removable: false,
},
Expand Down
32 changes: 32 additions & 0 deletions ui/selectors/selectors.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,38 @@ describe('Selectors', () => {
});
});

describe('#getNonTestNetworks', () => {
it('returns nonTestNetworks', () => {
const nonTestNetworks = selectors.getNonTestNetworks({
metamask: {
networkConfigurations: {},
},
});

// Assert that the `nonTestNetworks` array returned by the selector matches a specific structure.
expect(nonTestNetworks).toStrictEqual(
expect.arrayContaining([
expect.objectContaining({
chainId: expect.any(String),
nickname: expect.any(String),
rpcUrl: expect.any(String),
rpcPrefs: expect.objectContaining({
imageUrl: expect.any(String),
}),
providerType: expect.any(String),
ticker: expect.any(String),
id: expect.any(String),
removable: expect.any(Boolean),
}),
]),
);

// Verify that each network object has a 'ticker' property that is not undefined
nonTestNetworks.forEach((network) => {
expect(network.ticker).toBeDefined();
});
});
});
describe('#getAllNetworks', () => {
it('sorts Localhost to the bottom of the test lists', () => {
const networks = selectors.getAllNetworks({
Expand Down

0 comments on commit 9e810ee

Please sign in to comment.