import { buildWatchAssetRpcRequest } from '@/utils/walletWatchAsset'

describe('buildWatchAssetRpcRequest', () => {
  const token = {
    chainId: 138,
    address: '0x93E66202A11B1772E55407B32B44e5Cd8eda7f22',
    symbol: 'cUSDT',
    decimals: 6,
    logoURI: 'https://example.com/cusdt.svg',
  }

  it('uses numeric chainId on Ethereum mainnet desktop', () => {
    const req = buildWatchAssetRpcRequest({ ...token, chainId: 1 }, false)
    expect(req.params.options.chainId).toBe(1)
  })

  it('uses hex chainId on Chain 138 desktop', () => {
    const req = buildWatchAssetRpcRequest(token, false)
    expect(req.params.options.chainId).toBe('0x8a')
  })

  it('uses hex chainId on mobile', () => {
    const req = buildWatchAssetRpcRequest(token, true)
    expect(req.params.options.chainId).toBe('0x8a')
  })
})
