Skip to content

Commit

Permalink
fix: dest token unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
micaelae committed Jan 11, 2025
1 parent d9fe796 commit 7584fa1
Show file tree
Hide file tree
Showing 2 changed files with 326 additions and 84 deletions.
251 changes: 222 additions & 29 deletions ui/hooks/bridge/__snapshots__/useTokensWithFiltering.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`useTokensWithFiltering should not return tokens that are not in the allowlist 1`] = `
exports[`useTokensWithFiltering should fetch bridge tokens if cached tokens have old timestamp 1`] = `
[
{
"address": "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984",
"balance": "0.00184",
"chainId": "0x1",
"decimals": 6,
"image": "images/contract/uni.svg",
"isNative": false,
"string": "0.00184",
"tokenFiatAmount": 0.004232,
"type": "TOKEN",
},
{
"address": "0x0000000000000000000000000000000000000000",
"balance": "0.000000000000000014",
Expand All @@ -24,6 +35,46 @@ exports[`useTokensWithFiltering should not return tokens that are not in the all
"tokenFiatAmount": 2.5242500000000003e-14,
"type": "NATIVE",
},
{
"address": "0x514910771af9ca656af840dff83e8264ecf986ca",
"balance": "1",
"chainId": "0x1",
"image": "images/contract/chainlink.svg",
"isNative": false,
"string": "1",
"tokenFiatAmount": null,
"type": "TOKEN",
},
{
"address": "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984",
"balance": "0",
"chainId": "0xe708",
"image": undefined,
"isNative": false,
"string": "0",
"tokenFiatAmount": null,
"type": "TOKEN",
},
{
"address": "0x0000000000000000000000000000000000000000",
"balance": "0",
"chainId": "0x1",
"decimals": 18,
"iconUrl": "./images/eth_logo.svg",
"image": "./images/eth_logo.svg",
"name": "Ether",
"string": "0",
"symbol": "ETH",
"type": "NATIVE",
},
{
"address": "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984",
"balance": "",
"chainId": "0x1",
"decimals": 6,
"string": undefined,
"type": "TOKEN",
},
{
"address": "0x6b3595068778dd592e39a122f4f5a5cf09c90fe2",
"aggregators": [],
Expand All @@ -39,18 +90,6 @@ exports[`useTokensWithFiltering should not return tokens that are not in the all
"symbol": "SUSHI",
"type": "TOKEN",
},
{
"address": "0x0000000000000000000000000000000000000000",
"balance": "0x0",
"chainId": "0x1",
"decimals": 18,
"iconUrl": "./images/eth_logo.svg",
"image": "./images/eth_logo.svg",
"name": "Ether",
"string": "0x0",
"symbol": "ETH",
"type": "NATIVE",
},
{
"address": "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984",
"aggregators": [],
Expand All @@ -65,17 +104,31 @@ exports[`useTokensWithFiltering should not return tokens that are not in the all
"symbol": "UNI",
"type": "TOKEN",
},
{
"address": "0xdac17f958d2ee523a2206206994597c13d831ec7",
"aggregators": [],
"balance": "",
"chainId": "0x1",
"decimals": 6,
"erc20": true,
"iconUrl": "images/contract/usdt.svg",
"image": "images/contract/usdt.svg",
"name": "Tether USD",
"string": undefined,
"symbol": "USDT",
"type": "TOKEN",
},
]
`;

exports[`useTokensWithFiltering should return all tokens when chainId === activeChainId, sorted by balance 1`] = `
exports[`useTokensWithFiltering should return all tokens when chainId !== activeChainId and chainId has been imported, sorted by balance 1`] = `
[
{
"address": "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984",
"balance": "0.00184",
"chainId": "0x1",
"decimals": 6,
"image": undefined,
"image": "images/contract/uni.svg",
"isNative": false,
"string": "0.00184",
"tokenFiatAmount": 0.004232,
Expand Down Expand Up @@ -107,12 +160,34 @@ exports[`useTokensWithFiltering should return all tokens when chainId === active
"address": "0x514910771af9ca656af840dff83e8264ecf986ca",
"balance": "1",
"chainId": "0x1",
"image": undefined,
"image": "images/contract/chainlink.svg",
"isNative": false,
"string": "1",
"tokenFiatAmount": null,
"type": "TOKEN",
},
{
"address": "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984",
"balance": "0",
"chainId": "0xe708",
"image": undefined,
"isNative": false,
"string": "0",
"tokenFiatAmount": null,
"type": "TOKEN",
},
{
"address": "0x0000000000000000000000000000000000000000",
"balance": "0",
"chainId": "0x1",
"decimals": 18,
"iconUrl": "./images/eth_logo.svg",
"image": "./images/eth_logo.svg",
"name": "Ether",
"string": "0",
"symbol": "ETH",
"type": "NATIVE",
},
{
"address": "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984",
"balance": "",
Expand All @@ -137,22 +212,70 @@ exports[`useTokensWithFiltering should return all tokens when chainId === active
"type": "TOKEN",
},
{
"address": "0x0000000000000000000000000000000000000000",
"balance": "0x0",
"address": "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984",
"aggregators": [],
"balance": "",
"chainId": "0x1",
"decimals": 18,
"iconUrl": "./images/eth_logo.svg",
"image": "./images/eth_logo.svg",
"name": "Ether",
"string": "0x0",
"symbol": "ETH",
"erc20": true,
"iconUrl": "images/contract/uni.svg",
"image": "images/contract/uni.svg",
"name": "Uniswap",
"string": undefined,
"symbol": "UNI",
"type": "TOKEN",
},
{
"address": "0xdac17f958d2ee523a2206206994597c13d831ec7",
"aggregators": [],
"balance": "",
"chainId": "0x1",
"decimals": 6,
"erc20": true,
"iconUrl": "images/contract/usdt.svg",
"image": "images/contract/usdt.svg",
"name": "Tether USD",
"string": undefined,
"symbol": "USDT",
"type": "TOKEN",
},
]
`;

exports[`useTokensWithFiltering should return all tokens when chainId !== activeChainId and chainId has not been imported, sorted by balance 1`] = `
[
{
"address": "0x0000000000000000000000000000000000000000",
"balance": "0",
"chainId": "0x89",
"decimals": 18,
"iconUrl": "./images/pol-token.svg",
"image": "./images/pol-token.svg",
"name": "Polygon",
"string": "0",
"symbol": "POL",
"type": "NATIVE",
},
{
"address": "0x6b3595068778dd592e39a122f4f5a5cf09c90fe2",
"aggregators": [],
"balance": "",
"chainId": "0x89",
"decimals": 18,
"erc20": true,
"erc721": false,
"iconUrl": "images/contract/sushi.svg",
"image": "images/contract/sushi.svg",
"name": "SushiSwap",
"string": undefined,
"symbol": "SUSHI",
"type": "TOKEN",
},
{
"address": "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984",
"aggregators": [],
"balance": "",
"chainId": "0x1",
"chainId": "0x89",
"decimals": 18,
"erc20": true,
"iconUrl": "images/contract/uni.svg",
Expand All @@ -166,7 +289,7 @@ exports[`useTokensWithFiltering should return all tokens when chainId === active
"address": "0xdac17f958d2ee523a2206206994597c13d831ec7",
"aggregators": [],
"balance": "",
"chainId": "0x1",
"chainId": "0x89",
"decimals": 6,
"erc20": true,
"iconUrl": "images/contract/usdt.svg",
Expand All @@ -178,15 +301,85 @@ exports[`useTokensWithFiltering should return all tokens when chainId === active
},
{
"address": "0x0000000000000000000000000000000000000000",
"balance": "0x0",
"chainId": "0x1",
"balance": "0",
"chainId": "0x89",
"decimals": 18,
"iconUrl": "./images/eth_logo.svg",
"image": "./images/eth_logo.svg",
"image": "./images/pol-token.svg",
"name": "Ether",
"string": "0x0",
"string": "0",
"symbol": "ETH",
"type": "NATIVE",
},
{
"address": "0x12652c6d93fdb6f4f37d48a8687783c782bb0d10",
"aggregators": [],
"balance": "",
"chainId": "0x89",
"decimals": 18,
"erc20": true,
"iconUrl": "images/contract/NGL.svg",
"image": "images/contract/NGL.svg",
"name": "Entangle",
"string": undefined,
"symbol": "NGL",
"type": "TOKEN",
},
{
"address": "0xb50721bcf8d664c30412cfbc6cf7a15145234ad1",
"aggregators": [],
"balance": "",
"chainId": "0x89",
"decimals": 18,
"erc20": true,
"iconUrl": "images/contract/Arb.svg",
"image": "images/contract/Arb.svg",
"name": "Arbitrum",
"string": undefined,
"symbol": "ARB",
"type": "TOKEN",
},
{
"address": "0x4d0528598f916fd1d8dc80e5f54a8feedcfd4b18",
"aggregators": [],
"balance": "",
"chainId": "0x89",
"decimals": 18,
"erc20": true,
"iconUrl": "images/contract/ATOS.svg",
"image": "images/contract/ATOS.svg",
"name": "Atoshi",
"string": undefined,
"symbol": "ATOS",
"type": "TOKEN",
},
{
"address": "0x57b946008913b82e4df85f501cbaed910e58d26c",
"aggregators": [],
"balance": "",
"chainId": "0x89",
"decimals": 18,
"erc20": true,
"iconUrl": "images/contract/POND.svg",
"image": "images/contract/POND.svg",
"name": "POND",
"string": undefined,
"symbol": "POND",
"type": "TOKEN",
},
{
"address": "0x5eed99d066a8caf10f3e4327c1b3d8b673485eed",
"aggregators": [],
"balance": "",
"chainId": "0x89",
"decimals": 18,
"erc20": true,
"iconUrl": "images/contract/SEED.svg",
"image": "images/contract/SEED.svg",
"name": "SEED",
"string": undefined,
"symbol": "SEED",
"type": "TOKEN",
},
]
`;
Loading

0 comments on commit 7584fa1

Please sign in to comment.