import { describe, expect, it } from 'vitest'
import { normalizeMissionControlLiquidityPools } from './routes'

describe('normalizeMissionControlLiquidityPools', () => {
  it('accepts the nested backend proxy shape', () => {
    expect(
      normalizeMissionControlLiquidityPools({
        data: {
          count: 2,
          pools: [
            { address: '0x1', dex: 'DODO' },
            { address: '0x2', dex: 'Uniswap' },
          ],
        },
      })
    ).toEqual({
      count: 2,
      pools: [
        { address: '0x1', dex: 'DODO' },
        { address: '0x2', dex: 'Uniswap' },
      ],
    })
  })

  it('keeps working with a flat legacy shape', () => {
    expect(
      normalizeMissionControlLiquidityPools({
        pools: [{ address: '0xabc', dex: 'DODO' }],
      })
    ).toEqual({
      count: 1,
      pools: [{ address: '0xabc', dex: 'DODO' }],
    })
  })
})
