Skip to content

Commit

Permalink
test: update for the new behaivior
Browse files Browse the repository at this point in the history
  • Loading branch information
b00ste committed Sep 27, 2023
1 parent 8d247a8 commit 9ef792e
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 24 deletions.
24 changes: 0 additions & 24 deletions tests/LSP17ContractExtension/LSP17ExtendableTokens.behaviour.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,30 +145,6 @@ export const shouldBehaveLikeLSP17 = (buildContext: () => Promise<LSP17TestConte
'00000000000000000000000000000000'; // zero padded
});

describe('when calling the contract with empty calldata', () => {
describe('when making a call without any value', () => {
it('should revert', async () => {
await expect(
context.accounts[0].sendTransaction({
to: context.contract.address,
}),
).to.be.revertedWithCustomError(context.contract, 'InvalidFunctionSelector');
});
});

describe('when making a call with sending value', () => {
it('should revert', async () => {
const amountSent = 200;
await expect(
context.accounts[0].sendTransaction({
to: context.contract.address,
value: amountSent,
}),
).to.be.revertedWithCustomError(context.contract, 'InvalidFunctionSelector');
});
});
});

describe('when calling the contract with calldata', () => {
describe("when calling method that doesn't exist", () => {
describe('when there is no extension for the function called', () => {
Expand Down
26 changes: 26 additions & 0 deletions tests/LSP7DigitalAsset/LSP7DigitalAsset.behaviour.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2144,6 +2144,32 @@ export const shouldBehaveLikeLSP7 = (buildContext: () => Promise<LSP7TestContext
});
});
});

describe('when calling the contract with empty calldata', () => {
describe('when making a call without any value', () => {
it('should revert', async () => {
await expect(
context.accounts.anyone.sendTransaction({
to: context.lsp7.address,
}),
)
.to.be.revertedWithCustomError(context.lsp7, 'InvalidFunctionSelector')
.withArgs('0x00000000');
});
});

describe('when making a call with sending value', () => {
it('should revert', async () => {
const amountSent = 200;
await expect(
context.accounts.anyone.sendTransaction({
to: context.lsp7.address,
value: amountSent,
}),
).to.be.revertedWithCustomError(context.lsp7, 'LSP7TokenContractCannotHoldValue');
});
});
});
};

export type LSP7InitializeTestContext = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1765,6 +1765,32 @@ export const shouldBehaveLikeLSP8 = (buildContext: () => Promise<LSP8TestContext
});
});
});

describe('when calling the contract with empty calldata', () => {
describe('when making a call without any value', () => {
it('should revert', async () => {
await expect(
context.accounts.anyone.sendTransaction({
to: context.lsp8.address,
}),
)
.to.be.revertedWithCustomError(context.lsp8, 'InvalidFunctionSelector')
.withArgs('0x00000000');
});
});

describe('when making a call with sending value', () => {
it('should revert', async () => {
const amountSent = 200;
await expect(
context.accounts.anyone.sendTransaction({
to: context.lsp8.address,
value: amountSent,
}),
).to.be.revertedWithCustomError(context.lsp8, 'LSP8TokenContractCannotHoldValue');
});
});
});
};

export type LSP8InitializeTestContext = {
Expand Down

0 comments on commit 9ef792e

Please sign in to comment.