Skip to content

Commit

Permalink
chore(test): fixing stop tests
Browse files Browse the repository at this point in the history
  • Loading branch information
stoprocent committed Dec 17, 2024
1 parent bdb8ae8 commit 79b51a0
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions test/lib/hci-socket/bindings.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,22 +268,28 @@ describe('hci-socket bindings', () => {
assert.calledTwice(process.on);
});

describe('onExit', () => {
describe('stop', () => {
it('no handles', () => {
bindings._gap.stopScanning = fake.resolves(null);
bindings._hci.reset = fake.resolves(null);
bindings._hci.stop = fake.resolves(null);

bindings.onExit();
bindings.stop();

assert.calledOnce(bindings._gap.stopScanning);
assert.calledOnce(bindings._hci.reset);
assert.calledOnce(bindings._hci.stop);
});

it('with handles', () => {
bindings._gap.stopScanning = fake.resolves(null);
bindings._hci.disconnect = fake.resolves(null);
bindings._hci.reset = fake.resolves(null);
bindings._hci.stop = fake.resolves(null);

bindings._aclStreams = [1, 2, 3];

bindings.onExit();
bindings.stop();

assert.calledOnce(bindings._gap.stopScanning);
assert.calledThrice(bindings._hci.disconnect);
Expand Down

0 comments on commit 79b51a0

Please sign in to comment.