Skip to content

Commit

Permalink
Add tests for scanner
Browse files Browse the repository at this point in the history
  • Loading branch information
hannseman committed Jun 13, 2018
1 parent 99af9aa commit c7d0802
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/scanner.test.js
Expand Up @@ -166,4 +166,28 @@ describe("scanner", () => {
nobleMock.emit("discover", peripheral);
assert(eventSpy.calledWith(sinon.match.instanceOf(Error)));
});

it("should log on scanStart", () => {
const spyDebugLogger = sinon.spy(mockLogger, "debug");
new Scanner(mockLogger, "ABC");
nobleMock.emit("scanStart");
assert(spyDebugLogger.called);
spyDebugLogger.restore();
});

it("should log on scanStop", () => {
const spyDebugLogger = sinon.spy(mockLogger, "debug");
new Scanner(mockLogger, "ABC");
nobleMock.emit("scanStop");
assert(spyDebugLogger.called);
spyDebugLogger.restore();
});

it("should log on warning", () => {
const spyInfoLogger = sinon.spy(mockLogger, "info");
new Scanner(mockLogger, "ABC");
nobleMock.emit("warning", "some warning");
assert(spyInfoLogger.called);
spyInfoLogger.restore();
});
});

0 comments on commit c7d0802

Please sign in to comment.