Skip to content

Commit 41adb56

Browse files
committed
fix: Update nullish search bug in chainSupprotsPricing
1 parent 1a1737a commit 41adb56

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

ui/pages/asset/util.test.ts

+4-9
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ describe('findAssetByAddress', () => {
2828
});
2929

3030
it('should return undefined if address is not provided and no token without address is found', () => {
31-
expect(findAssetByAddress(mockTokens, undefined, '0x1')).toBeUndefined();
31+
expect(findAssetByAddress(mockTokens, undefined, '0x1')).toBeNull();
3232
});
3333

3434
it('should return the token without address if address is not provided and a token without address exists', () => {
@@ -37,14 +37,9 @@ describe('findAssetByAddress', () => {
3737
{ address: '', decimals: 18, symbol: 'NULL', name: 'Token NULL' },
3838
],
3939
};
40-
expect(findAssetByAddress(tokensWithNullAddress, undefined, '0x1')).toEqual(
41-
{
42-
address: '',
43-
decimals: 18,
44-
symbol: 'NULL',
45-
name: 'Token NULL',
46-
},
47-
);
40+
expect(
41+
findAssetByAddress(tokensWithNullAddress, undefined, '0x1'),
42+
).toBeNull();
4843
});
4944

5045
it('should return the correct token when address and chainId are provided', () => {

ui/pages/asset/util.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ export const findAssetByAddress = (
8383
}
8484

8585
if (!address) {
86-
return tokens.find((token) => !token.address);
86+
console.warn(`No token found for address: ${address}`);
87+
return null;
8788
}
8889

8990
return tokens.find(

0 commit comments

Comments
 (0)