[marketplace] add more tests
Add missing tests for `isSlotCancelled`. Add test ensuring that proofs cannot be marked as missed when a contract is cancelled.
This commit is contained in:
parent
34553ad7d9
commit
f16b9b07ae
|
@ -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
|
||||
|
|
|
@ -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")
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in New Issue