Add tests to extend code coverage (#2586)
This commit is contained in:
@ -120,6 +120,15 @@ contract('ERC1155PresetMinterPauser', function (accounts) {
|
||||
'ERC1155PresetMinterPauser: must have pauser role to pause',
|
||||
);
|
||||
});
|
||||
|
||||
it('other accounts cannot unpause', async function () {
|
||||
await this.token.pause({ from: deployer });
|
||||
|
||||
await expectRevert(
|
||||
this.token.unpause({ from: other }),
|
||||
'ERC1155PresetMinterPauser: must have pauser role to unpause',
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('burning', function () {
|
||||
|
||||
@ -84,7 +84,19 @@ contract('ERC20PresetMinterPauser', function (accounts) {
|
||||
});
|
||||
|
||||
it('other accounts cannot pause', async function () {
|
||||
await expectRevert(this.token.pause({ from: other }), 'ERC20PresetMinterPauser: must have pauser role to pause');
|
||||
await expectRevert(
|
||||
this.token.pause({ from: other }),
|
||||
'ERC20PresetMinterPauser: must have pauser role to pause',
|
||||
);
|
||||
});
|
||||
|
||||
it('other accounts cannot unpause', async function () {
|
||||
await this.token.pause({ from: deployer });
|
||||
|
||||
await expectRevert(
|
||||
this.token.unpause({ from: other }),
|
||||
'ERC20PresetMinterPauser: must have pauser role to unpause',
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@ -73,6 +73,15 @@ contract('ERC721URIStorage', function (accounts) {
|
||||
expect(await this.token.tokenURI(firstTokenId)).to.be.equal(baseURI + firstTokenId);
|
||||
});
|
||||
|
||||
it('tokens without URI can be burnt ', async function () {
|
||||
await this.token.burn(firstTokenId, { from: owner });
|
||||
|
||||
expect(await this.token.exists(firstTokenId)).to.equal(false);
|
||||
await expectRevert(
|
||||
this.token.tokenURI(firstTokenId), 'ERC721URIStorage: URI query for nonexistent token',
|
||||
);
|
||||
});
|
||||
|
||||
it('tokens with URI can be burnt ', async function () {
|
||||
await this.token.setTokenURI(firstTokenId, sampleUri);
|
||||
|
||||
|
||||
@ -97,6 +97,15 @@ contract('ERC721PresetMinterPauserAutoId', function (accounts) {
|
||||
'ERC721PresetMinterPauserAutoId: must have pauser role to pause',
|
||||
);
|
||||
});
|
||||
|
||||
it('other accounts cannot unpause', async function () {
|
||||
await this.token.pause({ from: deployer });
|
||||
|
||||
await expectRevert(
|
||||
this.token.unpause({ from: other }),
|
||||
'ERC721PresetMinterPauserAutoId: must have pauser role to unpause',
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('burning', function () {
|
||||
|
||||
Reference in New Issue
Block a user