diff --git a/test/Marketplace.test.js b/test/Marketplace.test.js index 38b89de..8b9955e 100644 --- a/test/Marketplace.test.js +++ b/test/Marketplace.test.js @@ -357,6 +357,20 @@ describe("Marketplace", function () { await expect(await marketplace.isCancelled(slot.request)).to.equal(true) }) + it("isSlotCancelled fails when slot is empty", async function () { + await expect( + marketplace.isSlotCancelled(slotId(slot)) + ).to.be.revertedWith("Slot empty") + }) + + it("isSlotCancelled is true once request is cancelled", async function () { + await marketplace.fillSlot(slot.request, slot.index, proof) + await waitUntilExpired(request.expiry) + await expect(await marketplace.isSlotCancelled(slotId(slot))).to.equal( + true + ) + }) + it("state is Cancelled when client withdraws funds", async function () { await expect(await marketplace.state(slot.request)).to.equal( RequestState.New diff --git a/test/Storage.test.js b/test/Storage.test.js index a3a76ba..d4de434 100644 --- a/test/Storage.test.js +++ b/test/Storage.test.js @@ -111,6 +111,15 @@ describe("Storage", function () { const expectedBalance = (collateralAmount * (100 - slashPercentage)) / 100 expect(await storage.balanceOf(host.address)).to.equal(expectedBalance) }) + + it("fails to mark proof as missing when cancelled", async function () { + await storage.fillSlot(slot.request, slot.index, proof) + await advanceTimeTo(request.expiry + 1) + let missedPeriod = periodOf(await currentTime()) + await expect( + storage.markProofAsMissing(slotId(slot), missedPeriod) + ).to.be.revertedWith("Request was cancelled") + }) }) })