feat: explorer API, wallet, CCIP scripts, and config refresh
- Backend REST/gateway/track routes, analytics, Blockscout proxy paths. - Frontend wallet and liquidity surfaces; MetaMask token list alignment. - Deployment docs, verification scripts, address inventory updates. Check: go build ./... under backend/ (pass). Made-with: Cursor
This commit is contained in:
42
frontend/src/utils/watchlist.test.ts
Normal file
42
frontend/src/utils/watchlist.test.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import {
|
||||
isWatchlistEntry,
|
||||
normalizeWatchlistAddress,
|
||||
parseStoredWatchlist,
|
||||
sanitizeWatchlistEntries,
|
||||
} from './watchlist'
|
||||
|
||||
describe('watchlist utils', () => {
|
||||
it('normalizes only valid addresses', () => {
|
||||
expect(normalizeWatchlistAddress(' 0x1234567890123456789012345678901234567890 ')).toBe(
|
||||
'0x1234567890123456789012345678901234567890',
|
||||
)
|
||||
expect(normalizeWatchlistAddress('not-an-address')).toBe('')
|
||||
})
|
||||
|
||||
it('filters invalid entries and deduplicates case-insensitively', () => {
|
||||
expect(
|
||||
sanitizeWatchlistEntries([
|
||||
'0x1234567890123456789012345678901234567890',
|
||||
'0x1234567890123456789012345678901234567890',
|
||||
'0x1234567890123456789012345678901234567890'.toUpperCase(),
|
||||
'bad',
|
||||
42,
|
||||
]),
|
||||
).toEqual(['0x1234567890123456789012345678901234567890'])
|
||||
})
|
||||
|
||||
it('parses stored JSON safely', () => {
|
||||
expect(parseStoredWatchlist('["0x1234567890123456789012345678901234567890"]')).toEqual([
|
||||
'0x1234567890123456789012345678901234567890',
|
||||
])
|
||||
expect(parseStoredWatchlist('not json')).toEqual([])
|
||||
})
|
||||
|
||||
it('matches saved addresses case-insensitively', () => {
|
||||
const entries = ['0x1234567890123456789012345678901234567890']
|
||||
expect(
|
||||
isWatchlistEntry(entries, '0x1234567890123456789012345678901234567890'.toUpperCase()),
|
||||
).toBe(true)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user