Added current temperature, humidity and firmware (#10)

* Added current temperature, humidity and firmware

* fixed wrong parameter

* linting

* fixed test cases

* fixed serverless test cases

* fixed test cases

* variable renamed

* version bump
This commit is contained in:
NickDub
2019-09-14 04:15:29 +02:00
committed by Martin M
parent 024aaa8a2c
commit 5b4361a23d
10 changed files with 314 additions and 3 deletions

View File

@@ -1,12 +1,14 @@
const delay = require('delay');
const ewelink = require('../main');
const {
email,
password,
singleChannelDeviceId,
fourChannelsDevice,
} = require('./_setup/credentials.json');
const {
loginExpectations,
allDevicesExpectations,
@@ -136,4 +138,27 @@ describe('env: node script', () => {
deviceVerifyAgain.params.switches[channel - 1].switch;
expect(currentState).toBe(currentStateVerifyAgain);
});
test('get channel count 1', async () => {
const result = await conn.getDeviceChannelCount(singleChannelDeviceId);
expect(typeof result).toBe('object');
expect(result.status).toBe('ok');
expect(result.switchesAmount).toBe(1);
});
test('get channel count 4', async () => {
const result = await conn.getDeviceChannelCount(fourChannelsDevice);
expect(typeof result).toBe('object');
expect(result.status).toBe('ok');
expect(result.switchesAmount).toBe(4);
});
test('get firmware version', async () => {
const device = await conn.getDevice(singleChannelDeviceId);
const currentVersion = device.params.fwVersion;
const firmware = await conn.getFirmwareVersion(singleChannelDeviceId);
expect(typeof firmware).toBe('object');
expect(firmware.status).toBe('ok');
expect(firmware.fwVersion).toBe(currentVersion);
});
});