Skip to content

Commit

Permalink
bump line coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
zajck committed Nov 21, 2023
1 parent 701ba1b commit d5004e9
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 0 deletions.
2 changes: 2 additions & 0 deletions scripts/config/revert-reasons.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,4 +214,6 @@ exports.RevertReasons = {
VOUCHER_NOT_RECEIVED: "VoucherNotReceived",
UNEXPECTED_ERC721_RECEIVED: "UnexpectedERC721Received",
FEE_AMOUNT_TOO_HIGH: "FeeAmountTooHigh",
INVALID_PRICE_DISCOVERY: "InvalidPriceDiscovery",
INVALID_CONDUIT_ADDRESS: "InvalidConduitAddress",
};
72 changes: 72 additions & 0 deletions test/protocol/PriceDiscoveryHandlerFacet.js
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,42 @@ describe("IPriceDiscoveryHandlerFacet", function () {
.commitToPriceDiscoveryOffer(buyer.address, tokenId, priceDiscovery, { value: price })
).to.revertedWithCustomError(bosonErrors, RevertReasons.VOUCHER_NOT_RECEIVED);
});

it("price discovery address is not set", async function () {
// An invalid price discovery address
priceDiscovery.priceDiscoveryContract = ZeroAddress;

// Attempt to commit, expecting revert
await expect(
priceDiscoveryHandler
.connect(buyer)
.commitToPriceDiscoveryOffer(buyer.address, tokenId, priceDiscovery, { value: price })
).to.revertedWithCustomError(bosonErrors, RevertReasons.INVALID_PRICE_DISCOVERY);
});

it("price discovery data is empty", async function () {
// An empty price discovery data
priceDiscovery.priceDiscoveryData = "0x";

// Attempt to commit, expecting revert
await expect(
priceDiscoveryHandler
.connect(buyer)
.commitToPriceDiscoveryOffer(buyer.address, tokenId, priceDiscovery, { value: price })
).to.revertedWithCustomError(bosonErrors, RevertReasons.INVALID_PRICE_DISCOVERY);
});

it("conduit address is not set", async function () {
// An invalid conduit address
priceDiscovery.conduit = ZeroAddress;

// Attempt to commit, expecting revert
await expect(
priceDiscoveryHandler
.connect(buyer)
.commitToPriceDiscoveryOffer(buyer.address, tokenId, priceDiscovery, { value: price })
).to.revertedWithCustomError(bosonErrors, RevertReasons.INVALID_CONDUIT_ADDRESS);
});
});
});

Expand Down Expand Up @@ -959,6 +995,42 @@ describe("IPriceDiscoveryHandlerFacet", function () {
priceDiscoveryHandler.connect(rando).commitToPriceDiscoveryOffer(buyer.address, tokenId, priceDiscovery)
).to.revertedWithCustomError(bosonErrors, RevertReasons.NOT_VOUCHER_HOLDER);
});

it("price discovery address is not set", async function () {
// An invalid price discovery address
priceDiscovery.priceDiscoveryContract = ZeroAddress;

// Attempt to commit, expecting revert
await expect(
priceDiscoveryHandler
.connect(assistant)
.commitToPriceDiscoveryOffer(buyer.address, tokenId, priceDiscovery)
).to.revertedWithCustomError(bosonErrors, RevertReasons.INVALID_PRICE_DISCOVERY);
});

it("price discovery data is empty", async function () {
// An empty price discovery data
priceDiscovery.priceDiscoveryData = "0x";

// Attempt to commit, expecting revert
await expect(
priceDiscoveryHandler
.connect(assistant)
.commitToPriceDiscoveryOffer(buyer.address, tokenId, priceDiscovery)
).to.revertedWithCustomError(bosonErrors, RevertReasons.INVALID_PRICE_DISCOVERY);
});

it("conduit address is not set", async function () {
// An invalid conduit address
priceDiscovery.conduit = ZeroAddress;

// Attempt to commit, expecting revert
await expect(
priceDiscoveryHandler
.connect(assistant)
.commitToPriceDiscoveryOffer(buyer.address, tokenId, priceDiscovery)
).to.revertedWithCustomError(bosonErrors, RevertReasons.INVALID_CONDUIT_ADDRESS);
});
});
});

Expand Down

0 comments on commit d5004e9

Please sign in to comment.