Skip to content

Commit

Permalink
fix(ci): ignore coverage on tests (ourzora#282)
Browse files Browse the repository at this point in the history
* chore: ignore coverage on test fixtures

* chore: ignore coverage on all other test mocks

* chore: ignore test folder in coverage CI

* test: bump coverage on fixed price allowed minters contract

* chore: update coverage min

* chore(test): fix allowed minter num tokens minted assertion

* chore(test): fix allowed minter num tokens minted assertion pt2

* Revert "chore: ignore coverage on test fixtures"

This reverts commit fcb376ffda6e0940703acab2c19033242ed1ad14.

* Revert "chore: ignore coverage on all other test mocks"

This reverts commit 59468fcd0d1d0456cf67a80797ec2ce5c9cd5a6b.
  • Loading branch information
kulkarohan authored Mar 27, 2024
1 parent 6f7b982 commit e18098c
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/1155.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ jobs:
uses: ./.github/workflows/coverage.yml
with:
package: "1155-contracts"
files_to_ignore: '"*DeploymentConfig*" "*Redeem*" "*deployment*" "*packages*"'
files_to_ignore: '"*DeploymentConfig*" "*Redeem*" "*deployment*" "*packages*" "*test*"'
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
uses: zgosalvez/github-actions-report-lcov@v2
with:
coverage-files: ./${{ env.package_folder }}/lcov.info
minimum-coverage: 89
minimum-coverage: 87
artifact-name: code-coverage-report
github-token: ${{ secrets.GITHUB_TOKEN }}
working-directory: ./${{ env.package_folder }}
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,55 @@ contract FixedPriceAllowedMintersStrategyTest is Test {
assertEq(fixedPrice.contractName(), "Fixed Price Allowed Minters Strategy");
}

function test_ContractURI() external {
assertEq(fixedPrice.contractURI(), "https://github.com/ourzora/zora-protocol/");
}

function test_Version() external {
assertEq(fixedPrice.contractVersion(), "1.0.0");
}

function test_SetSale() external {
vm.startPrank(admin);

uint256 newTokenId = target.setupNewToken("https://zora.co/testing/token.json", 10);
target.addPermission(newTokenId, address(fixedPrice), target.PERMISSION_BIT_MINTER());

target.callSale(
newTokenId,
fixedPrice,
abi.encodeWithSelector(
FixedPriceAllowedMintersStrategy.setSale.selector,
newTokenId,
IFixedPriceAllowedMintersStrategy.SalesConfig({
pricePerToken: 1 ether,
saleStart: 0,
saleEnd: type(uint64).max,
maxTokensPerAddress: 0,
fundsRecipient: address(0)
})
)
);

target.callSale(newTokenId, fixedPrice, abi.encodeWithSelector(IFixedPriceAllowedMintersStrategy.setMinters.selector, newTokenId, minters, true));

vm.stopPrank();

bool isMinter = fixedPrice.isMinter(address(target), newTokenId, minters[0]);
assertTrue(isMinter);

FixedPriceAllowedMintersStrategy.SalesConfig memory config = fixedPrice.sale(address(target), newTokenId);

assertEq(config.pricePerToken, 1 ether);
assertEq(config.saleStart, 0);
assertEq(config.saleEnd, type(uint64).max);
assertEq(config.maxTokensPerAddress, 0);
assertEq(config.fundsRecipient, address(0));

uint256 numMinted = fixedPrice.getMintedPerWallet(address(target), newTokenId, address(this));
assertEq(numMinted, 0);
}

function test_MintFromAllowedMinter() external {
vm.startPrank(admin);

Expand Down Expand Up @@ -93,6 +138,9 @@ contract FixedPriceAllowedMintersStrategyTest is Test {
assertEq(target.balanceOf(tokenRecipient, newTokenId), 10);
assertEq(address(target).balance, 10 ether);

uint256 numMinted = fixedPrice.getMintedPerWallet(address(target), newTokenId, allowedMinter); // We don't record the limit + num minted for this module
assertEq(numMinted, 0);

vm.stopPrank();
}

Expand Down

0 comments on commit e18098c

Please sign in to comment.