i'm currently passing 22 of 23 @openzeppelin/test-helpers
when i run $ truffle test
on my clone of the consensys supply-chain-exercise
why am i getting the following error and does it relate to the code below?
Wrong kind of exception received
+ expected - actual
-VM Exception while processing transaction: revert Not enough payment sent -- Reason given: Not enough payment sent.
+invalid opcode
modifier paidEnough(uint _price) {
require(msg.value >= _price, "Not enough payment sent"); // require(msg.value >= _price);
_;
}
function buyItem(uint sku) public payable forSale(sku) paidEnough(items[sku].price) checkValue(sku) { // 1. it should be payable in order to receive refunds
items[sku].seller.transfer(items[sku].price); // 2. this should transfer money to the seller
items[sku].buyer = msg.sender; // 3. set the buyer as the person who called this transaction
items[sku].state = State.Sold; // 4. set the state to Sold
// 5. this function should use 3 modifiers to check: if the item is for sale, if the buyer paid enough, and the value after the function is called to make sure the buyer is refunded any excess ether sent
emit LogSold(sku); // 6. call the event associated with this function
}
it("should error when not enough value is sent when purchasing an item", async () => {
await instance.addItem(name, price, { from: alice });
await expectRevert.assertion(instance.buyItem(0, { from: bob, value: 1 }));
});
thanks!