import { MAX_SINGLE_POOL_TVL_USD, sanePoolTvlUsd } from './token-visible-liquidity';

describe('sanePoolTvlUsd', () => {
  it('keeps canonical Chain 138 live pool TVL even when very large', () => {
    expect(
      sanePoolTvlUsd(138, '0x9e89bae009adf128782e19e8341996c596ac40dc', 33_200_672),
    ).toBe(33_200_672);
  });

  it('drops mis-normalized single-pool TVL above the sanity cap', () => {
    expect(
      sanePoolTvlUsd(138, '0xaae68830a55767722618e869882c6ed064cc1eb2', 51_558_997_888),
    ).toBe(0);
  });

  it('allows reasonable non-canonical pool TVL', () => {
    expect(
      sanePoolTvlUsd(138, '0xb53a0508940b1ff90f1aad4f6cb50a7012fe5593', 10_104_786),
    ).toBe(10_104_786);
  });

  it('exports a 500M sanity cap', () => {
    expect(MAX_SINGLE_POOL_TVL_USD).toBe(500_000_000);
  });
});
