mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2024-11-17 10:58:31 -07:00
47 lines
1.3 KiB
JavaScript
47 lines
1.3 KiB
JavaScript
const Availability = require('../lib/extension/deviceAvailability');
|
|
const utils = require('./utils');
|
|
|
|
describe('Availability', () => {
|
|
let availability;
|
|
|
|
beforeEach(() => {
|
|
utils.stubLogger(jest);
|
|
availability = new Availability(null, null, null, () => {});
|
|
});
|
|
|
|
afterEach(() => {
|
|
jest.restoreAllMocks();
|
|
});
|
|
|
|
describe('Determine pingable devices', () => {
|
|
it('Router device should be a pingable device', () => {
|
|
const device = {
|
|
powerSource: 'Mains (single phase)',
|
|
type: 'Router',
|
|
};
|
|
|
|
expect(availability.isPingable(device)).toBe(true);
|
|
});
|
|
|
|
it('Battery device should not be a pingable device', () => {
|
|
const device = {
|
|
powerSource: 'Battery',
|
|
type: 'EndDevice',
|
|
};
|
|
|
|
expect(availability.isPingable(device)).toBe(false);
|
|
});
|
|
|
|
it('E11-G13 should be a pingable device', () => {
|
|
const device = {
|
|
powerSource: 'Mains (single phase)',
|
|
type: 'EndDevice',
|
|
modelId: 'E11-G13',
|
|
manufId: 4448,
|
|
};
|
|
|
|
expect(availability.isPingable(device)).toBe(true);
|
|
});
|
|
});
|
|
});
|