add test for getPosition

This commit is contained in:
Daksh Miglani 2021-05-08 03:25:21 +05:30
parent 4d58a577f6
commit 14dd664e72
3 changed files with 23 additions and 14 deletions

View File

@ -213,18 +213,16 @@ contract Resolver is Helpers {
function getPosition(address owner, address[] memory crAddress)
public
returns (
CreamData[] memory,
CompReadInterface.CompBalanceMetadataExt memory
)
returns (CreamData[] memory)
// CompReadInterface.CompBalanceMetadataExt memory
{
return (
getCreamData(owner, crAddress),
CompReadInterface(getCreamReadAddress()).getCompBalanceMetadataExt(
getCreamToken(),
getComptroller(),
owner
)
getCreamData(owner, crAddress)
// CompReadInterface(getCreamReadAddress()).getCompBalanceMetadataExt(
// getCreamToken(),
// getComptroller(),
// owner
// )
);
}
}

View File

@ -31,17 +31,22 @@ module.exports = {
{
version: "0.7.3"
}
]
],
optimizer: {
enabled: true,
runs: 200,
},
},
networks: {
hardhat: {
forking: {
url: "https://eth-mainnet.alchemyapi.io/v2/" + ALCHEMY_API_KEY
url: "https://eth-mainnet.alchemyapi.io/v2/" + ALCHEMY_API_KEY,
blockNumber: 12386345
}
}
},
mocha: {
timeout: 50000,
timeout: 100000,
}
};

View File

@ -1,4 +1,5 @@
const { expect } = require("chai");
const { ethers } = require("hardhat");
describe("InstaCreamResolver", function () {
let cream;
@ -13,7 +14,12 @@ describe("InstaCreamResolver", function () {
await cream.deployed();
});
it("should fetch cream data from CrUSDT", async function () {
it("should fetch cream data for CrUSDT", async function () {
expect(await cream.getCreamData(signer.address, [CrUSDT])).to.exist;
});
it("should fetch cream position for CrUSDT", async function () {
const res = await cream.callStatic.getPosition(signer.address, [CrUSDT]);
expect(res).to.exist
});
});