Skip to content

Commit

Permalink
moved no voucher revert tests at the end
Browse files Browse the repository at this point in the history
  • Loading branch information
gfournieriExec committed Apr 30, 2024
1 parent e932f3f commit 13d1489
Showing 1 changed file with 24 additions and 23 deletions.
47 changes: 24 additions & 23 deletions test/beacon/Voucher.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -504,54 +504,55 @@ describe('Voucher', function () {
.withArgs(dealId);
});

it('Should not match orders boost when non-sponsored amount not transferable', async () => {
it('Should not match orders boost when sender is not allowed', async () => {
await expect(
voucherWithOwnerSigner.matchOrdersBoost(
voucherWithAnyoneSigner.matchOrdersBoost(
appOrder,
datasetOrder,
workerpoolOrder,
requestOrder,
),
)
.to.be.revertedWithCustomError(iexecPocoInstance, 'ERC20InsufficientAllowance')
.withArgs(await voucher.getAddress(), 0, dealPrice);
).to.be.revertedWith('Voucher: sender is not authorized');
});

it('Should not match orders boost when iExec Poco matching fails', async () => {
await iexecPocoInstance
.willRevertOnSponsorMatchOrdersBoost()
.then((tx) => tx.wait());
it('Should not match orders boost when voucher is expired', async () => {
const expirationDate = await voucher.getExpiration();
await time.setNextBlockTimestamp(expirationDate);
await expect(
voucherWithOwnerSigner.matchOrdersBoost(
{ ...appOrder, appprice: 0 },
{ ...datasetOrder, datasetprice: 0 },
{ ...workerpoolOrder, workerpoolprice: 0 },
appOrder,
datasetOrder,
workerpoolOrder,
requestOrder,
),
).to.be.revertedWith('IexecPocoMock: Failed to sponsorMatchOrdersBoost');
).to.be.revertedWith('Voucher: voucher is expired');
});
it('Should not match orders boost when sender is not allowed', async () => {

it('Should not match orders boost when non-sponsored amount not transferable', async () => {
await expect(
voucherWithAnyoneSigner.matchOrdersBoost(
voucherWithOwnerSigner.matchOrdersBoost(
appOrder,
datasetOrder,
workerpoolOrder,
requestOrder,
),
).to.be.revertedWith('Voucher: sender is not authorized');
)
.to.be.revertedWithCustomError(iexecPocoInstance, 'ERC20InsufficientAllowance')
.withArgs(await voucher.getAddress(), 0, dealPrice);
});

it('Should not match orders boost when voucher is expired', async () => {
const expirationDate = (await voucher.getExpiration())
await time.setNextBlockTimestamp(expirationDate);
it('Should not match orders boost when iExec Poco matching fails', async () => {
await iexecPocoInstance
.willRevertOnSponsorMatchOrdersBoost()
.then((tx) => tx.wait());
await expect(
voucherWithOwnerSigner.matchOrdersBoost(
appOrder,
datasetOrder,
workerpoolOrder,
{ ...appOrder, appprice: 0 },
{ ...datasetOrder, datasetprice: 0 },
{ ...workerpoolOrder, workerpoolprice: 0 },
requestOrder,
),
).to.be.revertedWith('Voucher: voucher is expired');
).to.be.revertedWith('IexecPocoMock: Failed to sponsorMatchOrdersBoost');
});
});
});
Expand Down

0 comments on commit 13d1489

Please sign in to comment.