Skip to content

Commit

Permalink
test: add tests for new custom error
Browse files Browse the repository at this point in the history
  • Loading branch information
CJ42 committed Sep 21, 2023
1 parent 044788d commit a0c1c1a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions implementations/test/ERC725X.behaviour.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,14 @@ export const shouldBehaveLikeERC725X = (buildContext: () => Promise<ERC725XTestC

expect(accountOwner).to.equal(context.accounts.anyone.address);
});

it('should revert when transferring ownership to `address(0)`', async () => {
await expect(
context.erc725X
.connect(context.accounts.owner)
.transferOwnership(ethers.constants.AddressZero),
).to.be.revertedWithCustomError(context.erc725X, 'OwnableCannotSetZeroAddressAsOwner');
});
});

describe('When non-owner is transferring ownership', () => {
Expand Down
8 changes: 8 additions & 0 deletions implementations/test/ERC725Y.behaviour.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ export const shouldBehaveLikeERC725Y = (buildContext: () => Promise<ERC725YTestC

expect(accountOwner).to.equal(context.accounts.anyone.address);
});

it('should revert when transferring ownership to `address(0)`', async () => {
await expect(
context.erc725Y
.connect(context.accounts.owner)
.transferOwnership(ethers.constants.AddressZero),
).to.be.revertedWithCustomError(context.erc725Y, 'OwnableCannotSetZeroAddressAsOwner');
});
});

describe('When non-owner is transferring ownership', () => {
Expand Down

0 comments on commit a0c1c1a

Please sign in to comment.