mirror of
https://github.com/luxfi/erc-3643.git
synced 2026-10-30 16:58:28 +00:00
# Version 4.0.1 All tests were rewritten using hardhat instead of truffle for optimisation and improvements (tests now properly check revert messages and emitted events). # Update in contract source: - Compliance module view methods no longer require the modifier `onlyComplianceBound`. - Update to version `4.0.1` - `coverage` folder and `coverage.json` are now ignored. - Update module exports. - Action on push (link & tests) now runs coverage and uploads coverage results to action artifacts. - Action on pre-release and release now runs coverage and uploads coverage results to release artifacts. - Update the license note date to 2023 (previously 2022) - Remove migrations contract # Update documentation - README updated - CONTRIBUTING documentation added - WhitePaper pdf added - remove outdated documentation on transfers --------- Co-authored-by: Joachim <[email protected]>
88 lines
3.1 KiB
TypeScript
88 lines
3.1 KiB
TypeScript
import { loadFixture } from '@nomicfoundation/hardhat-network-helpers';
|
|
import { expect } from 'chai';
|
|
import { deployFullSuiteFixture } from '../fixtures/deploy-full-suite.fixture';
|
|
|
|
describe('ClaimTopicsRegistry', () => {
|
|
describe('.init', () => {
|
|
describe('when contract was already initialized', () => {
|
|
it('should revert', async () => {
|
|
const {
|
|
suite: { claimTopicsRegistry },
|
|
} = await loadFixture(deployFullSuiteFixture);
|
|
|
|
await expect(claimTopicsRegistry.init()).to.be.revertedWith('Initializable: contract is already initialized');
|
|
});
|
|
});
|
|
});
|
|
|
|
describe('.addClaimTopic', () => {
|
|
describe('when sender is not owner', () => {
|
|
it('should revert', async () => {
|
|
const {
|
|
suite: { claimTopicsRegistry },
|
|
accounts: { anotherWallet },
|
|
} = await loadFixture(deployFullSuiteFixture);
|
|
|
|
await expect(claimTopicsRegistry.connect(anotherWallet).addClaimTopic(1)).to.be.revertedWith('Ownable: caller is not the owner');
|
|
});
|
|
});
|
|
|
|
describe('when sender is owner', () => {
|
|
describe('when topic array contains more than 14 elements', () => {
|
|
it('should revert', async () => {
|
|
const {
|
|
suite: { claimTopicsRegistry },
|
|
accounts: { deployer },
|
|
} = await loadFixture(deployFullSuiteFixture);
|
|
|
|
await Promise.all(Array.from({ length: 14 }, (_, i) => i).map((i) => claimTopicsRegistry.addClaimTopic(i)));
|
|
|
|
await expect(claimTopicsRegistry.connect(deployer).addClaimTopic(14)).to.be.revertedWith('cannot require more than 15 topics');
|
|
});
|
|
});
|
|
|
|
describe('when adding a topic that is already added', () => {
|
|
it('should revert', async () => {
|
|
const {
|
|
suite: { claimTopicsRegistry },
|
|
accounts: { deployer },
|
|
} = await loadFixture(deployFullSuiteFixture);
|
|
|
|
await claimTopicsRegistry.addClaimTopic(1);
|
|
|
|
await expect(claimTopicsRegistry.connect(deployer).addClaimTopic(1)).to.be.revertedWith('claimTopic already exists');
|
|
});
|
|
});
|
|
});
|
|
});
|
|
|
|
describe('.removeClaimTopic', () => {
|
|
describe('when sender is not owner', () => {
|
|
it('should revert', async () => {
|
|
const {
|
|
suite: { claimTopicsRegistry },
|
|
accounts: { anotherWallet },
|
|
} = await loadFixture(deployFullSuiteFixture);
|
|
|
|
await expect(claimTopicsRegistry.connect(anotherWallet).removeClaimTopic(1)).to.be.revertedWith('Ownable: caller is not the owner');
|
|
});
|
|
});
|
|
|
|
describe('when sender is owner', () => {
|
|
it('should remove claim topic', async () => {
|
|
const {
|
|
suite: { claimTopicsRegistry },
|
|
accounts: { deployer },
|
|
} = await loadFixture(deployFullSuiteFixture);
|
|
|
|
await claimTopicsRegistry.addClaimTopic(1);
|
|
await claimTopicsRegistry.addClaimTopic(2);
|
|
await claimTopicsRegistry.addClaimTopic(3);
|
|
|
|
const tx = await claimTopicsRegistry.connect(deployer).removeClaimTopic(2);
|
|
await expect(tx).to.emit(claimTopicsRegistry, 'ClaimTopicRemoved').withArgs(2);
|
|
});
|
|
});
|
|
});
|
|
});
|