Skip to content

Commit 0a3e640

Browse files
committed
test(backend): process queue pair
#80
1 parent 26751e8 commit 0a3e640

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

backend/test/QueueHandler.ts

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,14 @@ describe("QueueHandler", function () {
110110
const { queueHandler, distributionQueue } = await loadFixture(deployFixture);
111111

112112
await distributionQueue.addDistribution("HIN", "fbc880caac090c43");
113+
114+
const distributionQueueLengthBefore = await distributionQueue.getLength();
115+
expect(distributionQueueLengthBefore).to.equal(1);
116+
113117
await expect(queueHandler.processQueuePair()).to.be.rejectedWith("The distribution must first be approved/rejected");
118+
119+
const distributionQueueLengthAfter = await distributionQueue.getLength();
120+
expect(distributionQueueLengthAfter).to.equal(1);
114121
});
115122

116123
it("Transaction should be processed if distribution has 1 approval, 0 rejections", async function () {
@@ -120,10 +127,20 @@ describe("QueueHandler", function () {
120127
await distributionVerifier.verifyDistribution(1, true);
121128

122129
await sponsorshipQueue.addSponsorship("HIN", { value: hre.ethers.parseUnits("0.02") });
130+
131+
const distributionQueueLengthBefore = await distributionQueue.getLength();
132+
expect(distributionQueueLengthBefore).to.equal(1);
123133

134+
const sponsorshipQueueLengthBefore = await sponsorshipQueue.getLength();
135+
expect(sponsorshipQueueLengthBefore).to.equal(1);
136+
124137
await queueHandler.processQueuePair();
125-
});
126138

127-
// TODO: test dequeue
139+
const distributionQueueLengthAfter = await distributionQueue.getLength();
140+
expect(distributionQueueLengthAfter).to.equal(0);
141+
142+
const sponsorshipQueueLengthAfter = await sponsorshipQueue.getLength();
143+
expect(sponsorshipQueueLengthAfter).to.equal(0);
144+
});
128145
});
129146
});

0 commit comments

Comments
 (0)