Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR intends to add
foundry
support with all the tests ported fromhardhat
as-is (as much as possible) and does not aim to replacehardhat
.If there is demand for
hardhat
to be replaced, I would be happy to do that in a separate PR. Also happy to refactor the current foundry tests; didn't do that for this PR as its meant to be a as-is port over so it is easier to verify each tests.There is a similar PR which seems stale, so this PR aims to supersede that.
To run the tests:
Some Notes:
The
owner
reference is being used very loosely in the hardhat tests. Sometimes it meant 'owner of NFT', 'owner of loan', 'owner of lendingPool', so this has been renamed to a more specific role.This test in hardhat currently fails: https://github.com/LlamaLend/contracts/blob/master/test/lendingPool.js#L108 due to the older version of OpenZeppelin's ERC721 being used. Would recommend to update this test to reflect the error message from the updated OZ ERC721 contract. This shouldn't affect the integrity of the test because this test is for the
MockNFT
hence not too important. This occured becausepackage-lock.json
isn't committed so a user would always grab the newest OZ packages, so do consider committing this file for consistency.I believe this is a typo: https://github.com/LlamaLend/contracts/blob/master/test/listNfts.js#L39 , it seems to be
MockNFT
instead ofMockEnumerableNFT
.This test is incorrect: https://github.com/LlamaLend/contracts/blob/master/test/listNfts.js#L50 , the
MockNFT
does_currentTokenId++
so the tokenId starts from 0, hence pulling id 101 to 201 should return[101, 102, 103, 104]
, hence length of 4.Some Opinions:
Consider removing the test for the Mock NFTs, its not too useful to test mocks.
Consider moving the contracts in
contracts/mocks
totest
folder, then set thetest path
. Reference: https://hardhat.org/hardhat-runner/docs/config#path-configuration