Skip to content

Commit

Permalink
Increase test coverage for bySig
Browse files Browse the repository at this point in the history
  • Loading branch information
zZoMROT committed Nov 30, 2024
1 parent 0fc6846 commit e2a7a26
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/bySig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export enum NonceType {
Account, // Nonce for account
Selector, // Nonce for selector
Unique, // Nonce for unique
Invalid, // Invalid Type
}

/**
Expand Down
9 changes: 9 additions & 0 deletions test/contracts/BySig.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,15 @@ describe('BySig', function () {
});

describe('bySig', function () {
it('should return false for an invalid nonce type', async function () {
const { addrs: { alice }, token } = await loadFixture(deployAddressArrayMock);
const sig = {
traits: buildBySigTraits({ deadline: 0xffffffffff, nonceType: NonceType.Invalid, nonce: 0 }),
data: '0x',
};
await expect(token.bySig(alice, sig, '0x')).to.be.revertedWithCustomError(token, 'WrongNonceType');
});

it('should revert after traits deadline', async function () {
const { addrs: { alice }, token } = await loadFixture(deployAddressArrayMock);
const sig = {
Expand Down

0 comments on commit e2a7a26

Please sign in to comment.