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

Commit

Permalink
chore: add unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
javiergarciavera committed Feb 22, 2023
1 parent bd2972b commit 8d590ce
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/ERC1155Mintable.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ describe('ERC1155Mintable SDK', () => {

afterEach(() => {
contractFactoryMock.mockClear();
signer = {
getChainId: () => 80001,
};
});

it('should create "ERC1155Mintable" instance', () => {
Expand Down Expand Up @@ -187,6 +190,23 @@ describe('ERC1155Mintable SDK', () => {
});
});

it('[Deploy] - should deploy when polygon mainnet', async () => {
erc1155Mintable = new ERC1155Mintable(signer as unknown as ethers.Wallet);
const baseURI = faker.internet.url();
const contractURI = faker.internet.url();
signer = {
getChainId: () => 137,
};
await erc1155Mintable.deploy({
baseURI,
contractURI,
ids: [],
gas: '250',
});

expect(ContractFactory.prototype.deploy).toHaveBeenCalledTimes(1);
});

it('[Mint] - should return an Error if contract is not deployed', () => {
erc1155Mintable = new ERC1155Mintable(signer as unknown as ethers.Wallet);

Expand Down
13 changes: 13 additions & 0 deletions test/ERC721Mintable.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ describe('SDK', () => {

afterEach(() => {
contractFactoryMock.mockClear();
signer = {
getChainId: () => 80001,
};
});

it('should create "ERC721Mintable" instance', () => {
Expand Down Expand Up @@ -94,6 +97,16 @@ describe('SDK', () => {
expect(ContractFactory.prototype.deploy).toHaveBeenCalledTimes(1);
});

it('[Deploy] - should deploy when polygon mainnet', async () => {
eRC721Mintable = new ERC721Mintable(signer as unknown as ethers.Wallet);
signer = {
getChainId: () => 137,
};
await eRC721Mintable.deploy({ name: 'name', symbol: 'symbol', contractURI: 'URI' });

expect(ContractFactory.prototype.deploy).toHaveBeenCalledTimes(1);
});

it('[Mint] - should return an Error if contract is not deployed', () => {
eRC721Mintable = new ERC721Mintable(signer as unknown as ethers.Wallet);

Expand Down
22 changes: 22 additions & 0 deletions test/ERC721UserMintable.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ describe('SDK', () => {

afterEach(() => {
contractFactoryMock.mockClear();
signer = {
getChainId: () => 80001,
};
});

it('should create "ERC721UserMintable" instance', () => {
Expand Down Expand Up @@ -251,6 +254,25 @@ describe('SDK', () => {
);
});

it('[Deploy] - should deploy when polygon mainnet', async () => {
eRC721UserMintable = new ERC721UserMintable(signer as unknown as ethers.Wallet);
signer = {
getChainId: () => 137,
};
await eRC721UserMintable.deploy({
name: 'name',
symbol: 'symbol',
baseURI: 'URI',
contractURI: 'contractURI',
maxSupply: 10,
price: '1',
maxTokenRequest: 1,
gas: '250',
});

expect(ContractFactory.prototype.deploy).toHaveBeenCalledTimes(1);
});

it('[Mint] - should return an Error if contract is not deployed', () => {
eRC721UserMintable = new ERC721UserMintable(signer as unknown as ethers.Wallet);

Expand Down

0 comments on commit 8d590ce

Please sign in to comment.