import { describe, expect, it } from 'vitest'
import { searchCuratedPools } from './poolSearch'

const pools = [
  {
    chainId: 138,
    chainName: 'Chain 138',
    poolAddress: '0x9e89bAe009adf128782E19e8341996c596ac40dC',
    lpTokenAddress: '0x9e89bAe009adf128782E19e8341996c596ac40dC',
    lpTokenType: 'dodo_dvm' as const,
    venue: 'dodo_pmm' as const,
    baseSymbol: 'cUSDT',
    quoteSymbol: 'cUSDC',
    baseAddress: '0x93E66202A11B1772E55407B32B44e5Cd8eda7f22',
    quoteAddress: '0xf22258f57794CC8E06237084b353Ab30fFfa640b',
  },
]

describe('searchCuratedPools', () => {
  it('finds pool by address', () => {
    const matches = searchCuratedPools('0x9e89bAe009adf128782E19e8341996c596ac40dC', pools)
    expect(matches).toHaveLength(1)
    expect(matches[0].matchReason).toBe('exact pool address')
  })

  it('finds pool by pair symbol', () => {
    const matches = searchCuratedPools('cUSDT', pools)
    expect(matches).toHaveLength(1)
    expect(matches[0].pairLabel).toBe('cUSDT / cUSDC')
  })
})
