Change behavior of ceilDiv(0, 0) and improve test coverage (#4348)

This commit is contained in:
Ernesto García
2023-06-14 14:21:42 -06:00
committed by GitHub
parent ac5480e7ca
commit 2477534260
10 changed files with 178 additions and 2 deletions

View File

@ -85,6 +85,14 @@ contract('ERC721Consecutive', function (accounts) {
expect(await this.token.getVotes(account)).to.be.bignumber.equal(web3.utils.toBN(balance));
}
});
it('reverts on consecutive minting to the zero address', async function () {
await expectRevertCustomError(
ERC721ConsecutiveMock.new(name, symbol, offset, delegates, [ZERO_ADDRESS], [10]),
'ERC721InvalidReceiver',
[ZERO_ADDRESS],
);
});
});
describe('minting after construction', function () {
@ -172,6 +180,17 @@ contract('ERC721Consecutive', function (accounts) {
expect(await this.token.$_exists(tokenId)).to.be.equal(true);
expect(await this.token.ownerOf(tokenId), user2);
});
it('reverts burning batches of size != 1', async function () {
const tokenId = batches[0].amount + offset;
const receiver = batches[0].receiver;
await expectRevertCustomError(
this.token.$_afterTokenTransfer(receiver, ZERO_ADDRESS, tokenId, 2),
'ERC721ForbiddenBatchBurn',
[],
);
});
});
});
}