Skip to content

Commit 23755ca

Browse files
committed
test(NODE-4834): Separate tests more cleanly
1 parent a11a4f6 commit 23755ca

File tree

1 file changed

+24
-10
lines changed

1 file changed

+24
-10
lines changed

test/unit/cmap/connection.test.ts

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -633,18 +633,32 @@ describe('new Connection()', function () {
633633
expect(driverSocket.end).to.have.been.calledOnce;
634634
});
635635

636-
it('does not call stream.end if options.force == true', () => {
637-
connection.destroy({ force: true });
638-
clock.tick(1);
639-
expect(driverSocket.destroy).to.have.been.calledOnce;
640-
expect(driverSocket.end).to.not.have.been.called;
636+
context('when options.force == true', function () {
637+
it('calls steam.destroy', () => {
638+
connection.destroy({ force: true });
639+
clock.tick(1);
640+
expect(driverSocket.destroy).to.have.been.calledOnce;
641+
});
642+
643+
it('does not call stream.end', () => {
644+
connection.destroy({ force: true });
645+
clock.tick(1);
646+
expect(driverSocket.end).to.not.have.been.called;
647+
});
641648
});
642649

643-
it('does not call stream.destroy if options.force == false', () => {
644-
connection.destroy({ force: false });
645-
clock.tick(1);
646-
expect(driverSocket.destroy).to.not.have.been.called;
647-
expect(driverSocket.end).to.have.been.calledOnce;
650+
context('when options.force == false', function () {
651+
it('calls stream.end', () => {
652+
connection.destroy({ force: false });
653+
clock.tick(1);
654+
expect(driverSocket.end).to.have.been.calledOnce;
655+
});
656+
657+
it('does not call stream.destroy', () => {
658+
connection.destroy({ force: false });
659+
clock.tick(1);
660+
expect(driverSocket.destroy).to.not.have.been.called;
661+
});
648662
});
649663
});
650664
});

0 commit comments

Comments
 (0)