Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Commit

Permalink
feat(PTP-466): Tests completed
Browse files Browse the repository at this point in the history
  • Loading branch information
danielpavelicconsensys committed Jun 8, 2022
1 parent 70ec36a commit 2633f4e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 19 deletions.
4 changes: 3 additions & 1 deletion integration-test/writeContract.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,8 @@ describe('E2E Test: Basic NFT (write)', () => {

it('should renounce contract ownership', async () => {
const result = await contractObject.renounceOwnership();
expect(result).not.toBe(null);
const receipt = await result.wait();

expect(receipt.status).toBe(1);
});
});
7 changes: 1 addition & 6 deletions lib/ContractTemplates/ERC721Mintable/ERC721Mintable.js
Original file line number Diff line number Diff line change
Expand Up @@ -507,12 +507,7 @@ export default class ERC721Mintable {

/*
* Renouncing ownership of the smart contract (will leave the contract without an owner).
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
* @returns {bool} Success or fail of the operation
* @returns {object} Transaction object
*/
async renounceOwnership() {
if (!this.contractAddress && !this.#contractDeployed) {
Expand Down
19 changes: 7 additions & 12 deletions test/ERC721Mintable.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -691,25 +691,20 @@ describe('SDK', () => {
});
});
describe('renounceOwnership', () => {
it('[renounceOwnership] - should throw when args are missing (contractAddress)', async () => {
const contract = new ERC721Mintable(signer);
contract.contractAddress = null;

await expect(() => contract.renounceOwnership()).rejects.toThrow(
'[ERC721Mintable.renounceOwnership] Contract needs to be deployed',
);
});
it('[renounceOwnership] - should throw if contract not deployed', async () => {
const contract = new ERC721Mintable(signer);
eRC721Mintable = new ERC721Mintable(signer);
const renounceOwnership = async () => eRC721Mintable.renounceOwnership();

expect(contract.renounceOwnership()).rejects.toThrow(
expect(renounceOwnership).rejects.toThrow(
'[ERC721Mintable.renounceOwnership] Contract needs to be deployed',
);
});

it('[renounceOwnership] - should call renounce ownership', async () => {
const contract = new ERC721Mintable(signer);
await contract.deploy({ name: 'name', symbol: 'symbol', contractURI: 'URI' });
eRC721Mintable = new ERC721Mintable(signer);

await eRC721Mintable.deploy({ name: 'name', symbol: 'symbol', contractURI: 'URI' });
await eRC721Mintable.renounceOwnership();

expect(contractFactoryMock).toHaveBeenCalledTimes(1);
});
Expand Down

0 comments on commit 2633f4e

Please sign in to comment.