Skip to content

Commit 89bf54e

Browse files
testing
1 parent 6fcaa71 commit 89bf54e

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

test/subscriber.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,50 @@ describe('Subscriber', () => {
719719
});
720720
});
721721

722+
describe('nackWithResponse', () => {
723+
it('should modAck the message with a 0 deadline', async () => {
724+
const stub = sandbox.stub(subscriber, 'modAck');
725+
726+
await subscriber.nackWithResponse(message);
727+
728+
const [msg, deadline] = stub.lastCall.args;
729+
730+
assert.strictEqual(msg, message);
731+
assert.strictEqual(deadline, 0);
732+
});
733+
734+
it('should remove the message from the inventory', async () => {
735+
const inventory: FakeLeaseManager = stubs.get('inventory');
736+
const stub = sandbox.stub(inventory, 'remove').withArgs(message);
737+
738+
await subscriber.nackWithResponse(message);
739+
740+
assert.strictEqual(stub.callCount, 1);
741+
});
742+
});
743+
744+
describe('ackWithResponse', () => {
745+
it('should modAck the message with a 0 deadline', async () => {
746+
const stub = sandbox.stub(subscriber, 'modAck');
747+
748+
await subscriber.ackWithResponse(message);
749+
750+
const [msg, deadline] = stub.lastCall.args;
751+
752+
assert.strictEqual(msg, message);
753+
assert.strictEqual(deadline, 0);
754+
});
755+
756+
it('should remove the message from the inventory', async () => {
757+
const inventory: FakeLeaseManager = stubs.get('inventory');
758+
const stub = sandbox.stub(inventory, 'remove').withArgs(message);
759+
760+
await subscriber.ackWithResponse(message);
761+
762+
assert.strictEqual(stub.callCount, 1);
763+
});
764+
});
765+
722766
describe('open', () => {
723767
beforeEach(() => subscriber.close());
724768

0 commit comments

Comments
 (0)