Skip to content

Commit

Permalink
gah the linter
Browse files Browse the repository at this point in the history
  • Loading branch information
0age committed Apr 23, 2022
1 parent 87268dc commit 7c300ae
Showing 1 changed file with 62 additions and 19 deletions.
81 changes: 62 additions & 19 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5804,8 +5804,9 @@ describe(`Consideration (version: ${VERSION}) — initial test suite`, function

// cannot validate it with no signature from a random account
await whileImpersonating(owner.address, provider, async () => {
await expect(marketplaceContract.connect(owner).validate([order])).to
.be.revertedWith("InvalidSigner");
await expect(
marketplaceContract.connect(owner).validate([order])
).to.be.revertedWith("InvalidSigner");
});

// can validate it once you add the signature back
Expand Down Expand Up @@ -5894,8 +5895,9 @@ describe(`Consideration (version: ${VERSION}) — initial test suite`, function

// cannot validate it with no signature from a random account
await whileImpersonating(owner.address, provider, async () => {
await expect(marketplaceContract.connect(owner).validate([order])).to
.be.revertedWith("InvalidSigner");
await expect(
marketplaceContract.connect(owner).validate([order])
).to.be.revertedWith("InvalidSigner");
});

// can validate it from the seller
Expand Down Expand Up @@ -5973,8 +5975,9 @@ describe(`Consideration (version: ${VERSION}) — initial test suite`, function

// cannot validate it with no signature from a random account
await whileImpersonating(owner.address, provider, async () => {
await expect(marketplaceContract.connect(owner).validate([order])).to
.be.revertedWith("InvalidSigner");
await expect(
marketplaceContract.connect(owner).validate([order])
).to.be.revertedWith("InvalidSigner");
});

// can cancel it
Expand All @@ -5988,15 +5991,17 @@ describe(`Consideration (version: ${VERSION}) — initial test suite`, function

// cannot validate it from the seller
await whileImpersonating(seller.address, provider, async () => {
await expect(marketplaceContract.connect(seller).validate([order])).to
.be.revertedWith(`OrderIsCancelled("${orderHash}")`);
await expect(
marketplaceContract.connect(seller).validate([order])
).to.be.revertedWith(`OrderIsCancelled("${orderHash}")`);
});

// cannot validate it with a signature either
order.signature = signature;
await whileImpersonating(owner.address, provider, async () => {
await expect(marketplaceContract.connect(owner).validate([order])).to
.be.revertedWith(`OrderIsCancelled("${orderHash}")`);
await expect(
marketplaceContract.connect(owner).validate([order])
).to.be.revertedWith(`OrderIsCancelled("${orderHash}")`);
});

const newStatus = await marketplaceContract.getOrderStatus(orderHash);
Expand Down Expand Up @@ -11106,7 +11111,9 @@ describe(`Consideration (version: ${VERSION}) — initial test suite`, function
marketplaceContract
.connect(owner)
.matchOrders([order, mirrorOrder], fulfillments, { value })
).to.be.revertedWith("MismatchedFulfillmentOfferAndConsiderationComponents");
).to.be.revertedWith(
"MismatchedFulfillmentOfferAndConsiderationComponents"
);
});

fulfillments = defaultBuyNowMirrorFulfillment;
Expand Down Expand Up @@ -13396,7 +13403,11 @@ describe(`Consideration (version: ${VERSION}) — initial test suite`, function
.fulfillBasicOrder(basicOrderParameters, {
value: ethers.utils.parseEther("12"),
})
).to.be.revertedWith(`EtherTransferGenericFailure("${marketplaceContract.address}", ${ethers.utils.parseEther("1").toString()})`);
).to.be.revertedWith(
`EtherTransferGenericFailure("${
marketplaceContract.address
}", ${ethers.utils.parseEther("1").toString()})`
);
});
});
it("Reverts when tokens are not approved", async () => {
Expand Down Expand Up @@ -13585,7 +13596,13 @@ describe(`Consideration (version: ${VERSION}) — initial test suite`, function
marketplaceContract
.connect(buyer)
.fulfillAdvancedOrder(order, [], toAddress(false), { value })
).to.be.revertedWith(`TokenTransferGenericFailure("${testERC1155.address}", "${seller.address}", "${buyer.address}", ${nftId.toString()}, ${amount.mul(10).toString()})`);
).to.be.revertedWith(
`TokenTransferGenericFailure("${testERC1155.address}", "${
seller.address
}", "${buyer.address}", ${nftId.toString()}, ${amount
.mul(10)
.toString()})`
);
});
});
it("Reverts when transferred item amount is zero", async () => {
Expand Down Expand Up @@ -13758,7 +13775,11 @@ describe(`Consideration (version: ${VERSION}) — initial test suite`, function
marketplaceContract
.connect(buyer)
.fulfillAdvancedOrder(order, [], toAddress(false), { value })
).to.be.revertedWith(`BadReturnValueFromERC20OnTransfer("${testERC20.address}", "${buyer.address}", "${seller.address}", ${amount.mul(1000).toString()})`);
).to.be.revertedWith(
`BadReturnValueFromERC20OnTransfer("${testERC20.address}", "${
buyer.address
}", "${seller.address}", ${amount.mul(1000).toString()})`
);
});

let orderStatus = await marketplaceContract.getOrderStatus(orderHash);
Expand Down Expand Up @@ -13901,7 +13922,11 @@ describe(`Consideration (version: ${VERSION}) — initial test suite`, function
marketplaceContract
.connect(buyer)
.fulfillAdvancedOrder(order, [], toAddress(true), { value })
).to.be.revertedWith(`BadReturnValueFromERC20OnTransfer("${testERC20.address}", "${buyer.address}", "${seller.address}", ${amount.mul(1000).toString()})`);
).to.be.revertedWith(
`BadReturnValueFromERC20OnTransfer("${testERC20.address}", "${
buyer.address
}", "${seller.address}", ${amount.mul(1000).toString()})`
);
});

let orderStatus = await marketplaceContract.getOrderStatus(orderHash);
Expand Down Expand Up @@ -14291,7 +14316,11 @@ describe(`Consideration (version: ${VERSION}) — initial test suite`, function
marketplaceContract
.connect(buyer)
.fulfillAdvancedOrder(order, [], toAddress(false), { value })
).to.be.revertedWith(`TokenTransferGenericFailure("${marketplaceContract.address}", "${buyer.address}", "${seller.address}", 0, ${amount.toString()})`);
).to.be.revertedWith(
`TokenTransferGenericFailure("${marketplaceContract.address}", "${
buyer.address
}", "${seller.address}", 0, ${amount.toString()})`
);
});
});
it("Reverts when non-1155 account is supplied as the token", async () => {
Expand Down Expand Up @@ -14322,7 +14351,11 @@ describe(`Consideration (version: ${VERSION}) — initial test suite`, function
marketplaceContract
.connect(buyer)
.fulfillAdvancedOrder(order, [], toAddress(false), { value })
).to.be.revertedWith(`TokenTransferGenericFailure("${marketplaceContract.address}", "${seller.address}", "${buyer.address}", 0, ${amount.toString()})`);
).to.be.revertedWith(
`TokenTransferGenericFailure("${marketplaceContract.address}", "${
seller.address
}", "${buyer.address}", 0, ${amount.toString()})`
);
});
});
it("Reverts when 1155 batch non-token account is supplied as the token", async () => {
Expand Down Expand Up @@ -14452,7 +14485,13 @@ describe(`Consideration (version: ${VERSION}) — initial test suite`, function
marketplaceContract
.connect(owner)
.matchOrders([order, mirrorOrder], fulfillments, { value })
).to.be.revertedWith(`ERC1155BatchTransferGenericFailure("${marketplaceContract.address}", "${seller.address}", "${buyer.address}", [${nftId.toString()}, ${secondNftId.toString()}], [${amount.toString()}, ${secondAmount.toString()}])`);
).to.be.revertedWith(
`ERC1155BatchTransferGenericFailure("${
marketplaceContract.address
}", "${seller.address}", "${
buyer.address
}", [${nftId.toString()}, ${secondNftId.toString()}], [${amount.toString()}, ${secondAmount.toString()}])`
);
});

const orderStatus = await marketplaceContract.getOrderStatus(orderHash);
Expand Down Expand Up @@ -14511,7 +14550,11 @@ describe(`Consideration (version: ${VERSION}) — initial test suite`, function
marketplaceContract
.connect(buyer)
.fulfillBasicOrder(basicOrderParameters, { value })
).to.be.revertedWith(`EtherTransferGenericFailure("${marketplaceContract.address}", ${ethers.utils.parseEther("1").toString()})`);
).to.be.revertedWith(
`EtherTransferGenericFailure("${
marketplaceContract.address
}", ${ethers.utils.parseEther("1").toString()})`
);
});
});
});
Expand Down

0 comments on commit 7c300ae

Please sign in to comment.