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) function getPosition(address owner, address[] memory crAddress)
public public
returns ( returns (CreamData[] memory)
CreamData[] memory, // CompReadInterface.CompBalanceMetadataExt memory
CompReadInterface.CompBalanceMetadataExt memory
)
{ {
return ( return (
getCreamData(owner, crAddress), getCreamData(owner, crAddress)
CompReadInterface(getCreamReadAddress()).getCompBalanceMetadataExt( // CompReadInterface(getCreamReadAddress()).getCompBalanceMetadataExt(
getCreamToken(), // getCreamToken(),
getComptroller(), // getComptroller(),
owner // owner
) // )
); );
} }
} }

View File

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

View File

@ -1,4 +1,5 @@
const { expect } = require("chai"); const { expect } = require("chai");
const { ethers } = require("hardhat");
describe("InstaCreamResolver", function () { describe("InstaCreamResolver", function () {
let cream; let cream;
@ -13,7 +14,12 @@ describe("InstaCreamResolver", function () {
await cream.deployed(); 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; 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
});
}); });