QuickSwap / QuickSwap-sdk

MIT License
20 stars 50 forks source link

Test not working #1

Open LouisB739 opened 3 years ago

LouisB739 commented 3 years ago

Hello, I have failed tests when running yarn test. image image

MatiFalcone commented 3 years ago

You need to change all references to MAINNET by MATIC and all references to RINKEBY or ROPSTEN by MUMBAI in the tests files to make them pass.

sherajr commented 3 years ago

EDIT: Commenting out the contant bytecode and importing it solved the problem for me.

Uncomment this --> import { bytecode } from '@uniswap/v2-core/build/UniswapV2Pair.json' import { keccak256 } from '@ethersproject/solidity'

// const bytecode = "6080604052...

I'm still getting that first error after changing references.

$ yarn test yarn run v1.22.11 $ tsdx test FAIL test/constants.test.ts (7.983s) ● Console

console.log test/constants.test.ts:10
  0x8b9f063d0236fcbcf3195aefd700cb188c57b8589d76e984ab69fbc6d677935d

● constants › INIT_CODE_HASH › matches computed bytecode hash

expect(received).toEqual(expected) // deep equality

Expected: "0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f"
Received: "0x8b9f063d0236fcbcf3195aefd700cb188c57b8589d76e984ab69fbc6d677935d"

  12 |   describe('INIT_CODE_HASH', () => {
  13 |     it('matches computed bytecode hash', () => {
> 14 |       expect(COMPUTED_INIT_CODE_HASH).toEqual(INIT_CODE_HASH)
     |                                       ^
  15 |     })
  16 |   })
  17 | })

  at Object.<anonymous> (test/constants.test.ts:14:39)

PASS test/route.test.ts (8.672s) PASS test/fraction.test.ts (8.728s) PASS test/token.test.ts (8.739s) PASS test/pair.test.ts (8.79s) PASS test/router.test.ts (8.853s) PASS test/entities.test.ts (8.887s) PASS test/miscellaneous.test.ts (8.827s) PASS test/trade.test.ts (8.926s)

Test Suites: 1 failed, 1 skipped, 8 passed, 9 of 10 total Tests: 1 failed, 3 skipped, 123 passed, 127 total Snapshots: 0 total Time: 11.522s Ran all test suites. error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.