All files / tests/mocks token.ts

92.3% Statements 12/13
0% Branches 0/12
75% Functions 3/4
85.71% Lines 6/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131  4x   4x                               34x                                                                                                                                                                                                                     4x 18x   4x  
import { SwapIDL, Token } from '@/declarations';
import { parseSupportedTokenList } from 'integrations';
 
export const mockToken = ({
  decimals,
  fee,
  id,
  name,
  symbol,
  totalSupply,
}: Partial<SwapIDL.TokenInfoExt>): SwapIDL.TokenInfoExt => ({
  decimals: decimals || 12,
  fee: fee || BigInt('2000000000'),
  id: id || 'aanaa-xaaaa-aaaah-aaeiq-cai',
  name: name || 'Cycles',
  symbol: symbol || 'XTC',
  totalSupply: totalSupply || BigInt('568886793566866910'),
});
 
export const mockSupportedTokenListResponse = (): SwapIDL.TokenInfoExt[] => [
  {
    id: 'aanaa-xaaaa-aaaah-aaeiq-cai',
    fee: BigInt('2000000000'),
    decimals: 12,
    name: 'Cycles',
    totalSupply: BigInt('568951992843769366'),
    symbol: 'XTC',
  },
  {
    id: 'utozz-siaaa-aaaam-qaaxq-cai',
    fee: BigInt('0'),
    decimals: 8,
    name: 'WICP',
    totalSupply: BigInt('3851094737272'),
    symbol: 'WICP',
  },
  {
    id: 'onuey-xaaaa-aaaah-qcf7a-cai',
    fee: BigInt('100000'),
    decimals: 8,
    name: 'USDT Test',
    totalSupply: BigInt('100000000000000'),
    symbol: 'USDT',
  },
  {
    id: 'oexpe-biaaa-aaaah-qcf6q-cai',
    fee: BigInt('100000'),
    decimals: 8,
    name: 'USDC Test',
    totalSupply: BigInt('201000000000000'),
    symbol: 'USDC',
  },
  {
    id: 'a7saq-3aaaa-aaaai-qbcdq-cai',
    fee: BigInt('0'),
    decimals: 8,
    name: 'TEST TOKEN',
    totalSupply: BigInt('2156879855'),
    symbol: 'TEST_TOKEN',
  },
  {
    id: 'kftk5-4qaaa-aaaah-aa5lq-cai',
    fee: BigInt('0'),
    decimals: 8,
    name: 'test token',
    totalSupply: BigInt('0'),
    symbol: 'TEST',
  },
  {
    id: 'li5ot-tyaaa-aaaah-aa5ma-cai',
    fee: BigInt('0'),
    decimals: 8,
    name: 'wicp',
    totalSupply: BigInt('0'),
    symbol: 'WICP',
  },
  {
    id: 'gagfc-iqaaa-aaaah-qcdvq-cai',
    fee: BigInt('100000'),
    decimals: 8,
    name: 'WICP Test',
    totalSupply: BigInt('110012000000000'),
    symbol: 'WICP',
  },
  {
    id: 'wjsrf-myaaa-aaaam-qaayq-cai',
    fee: BigInt('0'),
    decimals: 8,
    name: 'wicp',
    totalSupply: BigInt('126500000'),
    symbol: 'WICP',
  },
  {
    id: 'u2nsf-eaaaa-aaaam-qaawa-cai',
    fee: BigInt('0'),
    decimals: 8,
    name: 'wicp',
    totalSupply: BigInt('0'),
    symbol: 'WICP',
  },
  {
    id: 'gvbup-jyaaa-aaaah-qcdwa-cai',
    fee: BigInt('100000'),
    decimals: 8,
    name: 'XTC Test',
    totalSupply: BigInt('110115300000000'),
    symbol: 'XTC',
  },
  {
    id: 'xe4vl-dqaaa-aaaam-qaa7a-cai',
    fee: BigInt('0'),
    decimals: 8,
    name: 'WICP',
    totalSupply: BigInt('0'),
    symbol: 'WICP',
  },
  {
    id: 'cfoim-fqaaa-aaaai-qbcmq-cai',
    fee: BigInt('0'),
    decimals: 8,
    name: 'Beta Token',
    totalSupply: BigInt('8911419172'),
    symbol: 'BTKN',
  },
];
 
export const mockTokenList = (): Token.MetadataList =>
  parseSupportedTokenList(mockSupportedTokenListResponse());
 
export const mockTokenId = (): string => 'aanaa-xaaaa-aaaah-aaeiq-cai';