fix tests
This commit is contained in:
@ -8,7 +8,7 @@ interface IUniswapV2Factory {
|
||||
function sortTokens(address tokenA, address tokenB) external pure returns (address, address);
|
||||
function getExchange(address tokenA, address tokenB) external view returns (address);
|
||||
function getTokens(address exchange) external view returns (address, address);
|
||||
function getExchanges() external view returns (address[] memory);
|
||||
function getExchanges(uint) external view returns (address);
|
||||
function getExchangesCount() external view returns (uint);
|
||||
|
||||
function createExchange(address tokenA, address tokenB) external returns (address exchange);
|
||||
|
||||
13
package.json
13
package.json
@ -6,15 +6,16 @@
|
||||
"solc": "0.5.13"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/chai": "^4.2.3",
|
||||
"@types/chai": "^4.2.6",
|
||||
"@types/mocha": "^5.2.7",
|
||||
"chai": "^4.2.0",
|
||||
"ethereum-waffle": "^2.1.1",
|
||||
"ethereumjs-util": "^6.1.0",
|
||||
"ethereum-waffle": "2.1.0",
|
||||
"ethereumjs-util": "^6.2.0",
|
||||
"ethers": "^4.0.40",
|
||||
"mocha": "^6.2.2",
|
||||
"prettier": "^1.18.2",
|
||||
"ts-node": "^8.4.1",
|
||||
"typescript": "^3.6.4"
|
||||
"prettier": "^1.19.1",
|
||||
"ts-node": "^8.5.4",
|
||||
"typescript": "^3.7.3"
|
||||
},
|
||||
"scripts": {
|
||||
"prettier:check": "yarn prettier ./test/*.ts --check",
|
||||
|
||||
@ -32,7 +32,7 @@ describe('UniswapV2Factory', () => {
|
||||
|
||||
it('exchangeBytecode', async () => {
|
||||
expect(await factory.exchangeBytecode()).to.eq(bytecode)
|
||||
expect(await factory.getExchangesLength()).to.eq(0)
|
||||
expect(await factory.getExchangesCount()).to.eq(0)
|
||||
})
|
||||
|
||||
async function createExchange(tokens: string[]) {
|
||||
@ -46,14 +46,11 @@ describe('UniswapV2Factory', () => {
|
||||
'UniswapV2Factory: EXCHANGE_EXISTS'
|
||||
)
|
||||
|
||||
expect(await factory.getExchangesLength()).to.eq(1)
|
||||
expect(await factory.getTokens(create2Address)).to.deep.eq([TEST_ADDRESSES.token0, TEST_ADDRESSES.token1])
|
||||
expect(await factory.getExchange(...tokens)).to.eq(create2Address)
|
||||
expect(await factory.getExchange(...tokens.slice().reverse())).to.eq(create2Address)
|
||||
expect(await factory.getOtherTokens(tokens[0])).to.deep.eq([tokens[1]])
|
||||
expect(await factory.getOtherTokens(tokens[1])).to.deep.eq([tokens[0]])
|
||||
expect(await factory.getOtherTokensLength(tokens[0])).to.deep.eq(bigNumberify(1))
|
||||
expect(await factory.getOtherTokensLength(tokens[1])).to.deep.eq(bigNumberify(1))
|
||||
expect(await factory.getTokens(create2Address)).to.deep.eq([TEST_ADDRESSES.token0, TEST_ADDRESSES.token1])
|
||||
expect(await factory.getExchanges(0)).to.eq(create2Address)
|
||||
expect(await factory.getExchangesCount()).to.eq(1)
|
||||
|
||||
const exchange = new Contract(create2Address, JSON.stringify(UniswapV2.abi), provider)
|
||||
expect(await exchange.factory()).to.eq(factory.address)
|
||||
|
||||
Reference in New Issue
Block a user