import { describe, expect, it } from 'vitest';
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://explorer.d-bis.org'],
      iconUrls: ['https://explorer.d-bis.org/favicon.ico'],
      oracles: [{ name: 'ETH/USD', address: '0x3304b747e565a97ec8ac220b0b6a1f6ffdb837e6' }],
    } as never);

    expect(out).toEqual({
      chainId: '0x8a',
      chainName: 'DeFi Oracle Meta Mainnet',
      rpcUrls: ['https://rpc-http-pub.d-bis.org'],
      nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },
      blockExplorerUrls: ['https://explorer.d-bis.org'],
      iconUrls: ['https://explorer.d-bis.org/favicon.ico'],
    });
    expect(out).not.toHaveProperty('chainIdDecimal');
    expect(out).not.toHaveProperty('oracles');
  });
});
