This repository has been archived by the owner on Feb 11, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
19 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,30 @@ | ||
const AccessoryManager = require('./AccessoryManager'); | ||
const AccessoryManager = require('./AccessoryManager') | ||
|
||
describe('_findNodeSerialNumber', () => { | ||
const mockZwave = {}, | ||
manager = new AccessoryManager({}, {}, console.log, mockZwave); | ||
const mockZwave = {} | ||
const manager = new AccessoryManager({}, {}, console.log, mockZwave) | ||
|
||
function mockFindNodeResult(result) { | ||
mockZwave.findNodeValue = (_nodeId, _options = {}) => result; | ||
function mockFindNodeResult (result) { | ||
mockZwave.findNodeValue = (_nodeId, _options = {}) => result | ||
} | ||
|
||
test('returns serialNumber if provided by ZWave', () => { | ||
mockFindNodeResult({ value: '12345'}); | ||
expect(manager._findNodeSerialNumber(1)).toBe('12345'); | ||
}); | ||
mockFindNodeResult({ value: '12345' }) | ||
expect(manager._findNodeSerialNumber(1)).toBe('12345') | ||
}) | ||
|
||
test('returns null if ZWave value is undefined', () => { | ||
mockFindNodeResult({ value: undefined }); | ||
expect(manager._findNodeSerialNumber(1)).toBe(null); | ||
}); | ||
mockFindNodeResult({ value: undefined }) | ||
expect(manager._findNodeSerialNumber(1)).toBe(null) | ||
}) | ||
|
||
test('returns null if ZWave result is empty', () => { | ||
mockFindNodeResult({}); | ||
expect(manager._findNodeSerialNumber(1)).toBe(null); | ||
}); | ||
mockFindNodeResult({}) | ||
expect(manager._findNodeSerialNumber(1)).toBe(null) | ||
}) | ||
|
||
test('returns null if entire ZWave result is undefined', () => { | ||
mockFindNodeResult(undefined); | ||
expect(manager._findNodeSerialNumber(1)).toBe(null); | ||
}); | ||
}); | ||
mockFindNodeResult(undefined) | ||
expect(manager._findNodeSerialNumber(1)).toBe(null) | ||
}) | ||
}) |