Release v1.10.0 (#38)

* 100% coverage for mixins/user/regionMixin.js

* check if websocket connection is valid json

* removed unnecessary delays

* added more test cases

* move constants to json files

* renamed login method to getCredentials

* mixin renamed

* don’t export internal methods

* mixin renamed

* keep socket connection opened

* using new getCredentials method

* reanmed login to credentials

* version bump
This commit is contained in:
Martin M
2019-11-29 02:25:38 -03:00
committed by GitHub
parent 303d7d4cc4
commit 6e240c181f
21 changed files with 264 additions and 195 deletions

View File

@@ -10,7 +10,7 @@ const {
} = require('./_setup/credentials.json');
const {
loginExpectations,
credentialsExpectations,
allDevicesExpectations,
specificDeviceExpectations,
} = require('./_setup/expectations');
@@ -26,10 +26,10 @@ describe('env: node script', () => {
await delay(1000);
});
test('login into ewelink', async () => {
const login = await conn.login();
expect(typeof login).toBe('object');
expect(login).toMatchObject(loginExpectations);
test('get ewelink credentials', async () => {
const credentials = await conn.getCredentials();
expect(typeof credentials).toBe('object');
expect(credentials).toMatchObject(credentialsExpectations);
});
test('get all devices', async () => {
@@ -69,7 +69,6 @@ describe('env: node script', () => {
test('set single channel device power state', async () => {
jest.setTimeout(30000);
await delay(3000);
const device = await conn.getDevice(singleChannelDeviceId);
const currentState = device.params.switch;
const newState = currentState === 'on' ? 'off' : 'on';
@@ -87,7 +86,6 @@ describe('env: node script', () => {
test('set multi channel device power state', async () => {
jest.setTimeout(30000);
await delay(3000);
const channel = 3;
const device = await conn.getDevice(fourChannelsDevice);
const currentState = device.params.switches[channel - 1].switch;
@@ -107,7 +105,6 @@ describe('env: node script', () => {
test('toggle single channel device power state', async () => {
jest.setTimeout(30000);
await delay(3000);
const device = await conn.getDevice(singleChannelDeviceId);
const currentState = device.params.switch;
const newState = currentState === 'on' ? 'off' : 'on';
@@ -123,7 +120,6 @@ describe('env: node script', () => {
test('toggle multi channel device power state', async () => {
jest.setTimeout(30000);
await delay(3000);
const channel = 3;
const device = await conn.getDevice(fourChannelsDevice);
const currentState = device.params.switches[channel - 1].switch;