import { toWalletAddEthereumChainParams } from './wallet-add-ethereum-chain';

describe('toWalletAddEthereumChainParams', () => {
  it('strips MetaMask-unsupported keys', () => {
    const out = toWalletAddEthereumChainParams({
      chainId: '0x8a',
      chainIdDecimal: 138,
      chainName: 'Defi Oracle Meta Mainnet',
      rpcUrls: ['https://rpc-http-pub.d-bis.org', 'wss://rpc-ws-pub.d-bis.org'],
      nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },
      blockExplorerUrls: ['https://blockscout.defi-oracle.io'],
      iconUrls: ['https://blockscout.defi-oracle.io/favicon.ico'],
      oracles: [{ name: 'ETH/USD', address: '0x3304b747e565a97ec8ac220b0b6a1f6ffdb837e6' }],
    } as never);

    expect(out).toEqual({
      chainId: '0x8a',
      chainName: 'Defi Oracle Meta Mainnet',
      rpcUrls: ['https://rpc.public-0138.defi-oracle.io'],
      nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },
      blockExplorerUrls: ['https://blockscout.defi-oracle.io'],
      iconUrls: ['https://blockscout.defi-oracle.io/favicon.ico'],
    });
    expect(out).not.toHaveProperty('chainIdDecimal');
    expect(out).not.toHaveProperty('oracles');
  });
});
