Uniswap / smart-order-router

GNU General Public License v3.0
413 stars 420 forks source link

3.20.1 tests are failing #471

Open leon-do opened 10 months ago

leon-do commented 10 months ago

I'm having trouble testing the main branch.

Steps git clone git@github.com:Uniswap/smart-order-router.git cd smart-order-router npm install npm run build npm run test

Error

Summary of all failing tests
 FAIL  test/unit/providers/token-properties-provider.test.ts (8.714 s)
  ● TokenPropertiesProvider › get token fees by address › real ETH and BITBOY token fee fetch, only BITBOY fetched

    expect(received).toBeDefined()

    Received: undefined

      222 |
      223 |       expect(tokenPropertiesMap[BITBOY.address.toLowerCase()]).toBeDefined();
    > 224 |       expect(tokenPropertiesMap[BITBOY.address.toLowerCase()]?.tokenFeeResult).toBeDefined();
          |                                                                                ^
      225 |       expect(tokenPropertiesMap[BITBOY.address.toLowerCase()]?.tokenValidationResult).toBeDefined();
      226 |       assertExpectedTokenProperties(tokenPropertiesMap[BITBOY.address.toLowerCase()],
      227 |         BITBOY?.buyFeeBps,

      at Object.<anonymous> (test/unit/providers/token-properties-provider.test.ts:224:80)

 FAIL  test/unit/providers/token-fee-fetcher.test.ts
  ● TokenFeeFetcher › Fetch WETH and BITBOY, should only return BITBOY

    expect(received).toBeDefined()

    Received: undefined

      25 |     const tokenFeeMap = await tokenFeeFetcher.fetchFees([WETH9[ChainId.MAINNET]!.address, BITBOY.address])
      26 |     expect(tokenFeeMap).not.toContain(WETH9[ChainId.MAINNET]!.address)
    > 27 |     expect(tokenFeeMap[BITBOY.address]).toBeDefined()
         |                                         ^
      28 |     expect(tokenFeeMap[BITBOY.address]?.buyFeeBps).toEqual(BITBOY.buyFeeBps)
      29 |     expect(tokenFeeMap[BITBOY.address]?.sellFeeBps).toEqual(BITBOY.sellFeeBps)
      30 |   });

      at Object.<anonymous> (test/unit/providers/token-fee-fetcher.test.ts:27:41)

  ● TokenFeeFetcher › Fetch BULLET and BITBOY, should return BOTH

    expect(received).toBeDefined()

    Received: undefined

      32 |   it('Fetch BULLET and BITBOY, should return BOTH', async () => {
      33 |     const tokenFeeMap = await tokenFeeFetcher.fetchFees([BULLET.address, BITBOY.address])
    > 34 |     expect(tokenFeeMap[BULLET.address]).toBeDefined()
         |                                         ^
      35 |     expect(tokenFeeMap[BULLET.address]?.buyFeeBps).toEqual(BULLET.buyFeeBps)
      36 |     expect(tokenFeeMap[BULLET.address]?.sellFeeBps).toEqual(BULLET.sellFeeBps)
      37 |     expect(tokenFeeMap[BITBOY.address]).toBeDefined()

      at Object.<anonymous> (test/unit/providers/token-fee-fetcher.test.ts:34:41)

Test Suites: 2 failed, 1 skipped, 19 passed, 21 of 22 total
Tests:       3 failed, 1 skipped, 171 passed, 175 total
Snapshots:   0 total
Time:        12.267 s
Ran all test suites matching /test\/unit/i.

node version 18

thank you @jsy1218

anixon604 commented 7 months ago

It'll pass if you create a .env file in root and add a JSON_RPC_PROVIDER value.