Release v1.8.1 (#28)

* new method to get user region

* added new test

* version bump
This commit is contained in:
Martin M
2019-11-11 00:22:08 -03:00
committed by GitHub
parent e6f60724f1
commit 98b8d8a97c
7 changed files with 62 additions and 2 deletions

View File

@@ -1,6 +1,7 @@
{
"email": "<your ewelink email>",
"password": "<your ewelink password>",
"region": "<your ewelink region>",
"singleChannelDeviceId": "<your device id>",
"deviceIdWithPower": "<your device id>",
"deviceIdWithoutPower": "<your device id>",

View File

@@ -50,6 +50,11 @@ const firmwareExpectations = {
msg: expect.any(String),
};
const regionExpectations = {
email: expect.any(String),
region: expect.any(String),
};
module.exports = {
loginExpectations,
allDevicesExpectations,
@@ -57,4 +62,5 @@ module.exports = {
rawPowerUsageExpectations,
currentMonthPowerUsageExpectations,
firmwareExpectations,
regionExpectations,
};

21
test/user.spec.js Normal file
View File

@@ -0,0 +1,21 @@
const ewelink = require('../main');
const { email, password, region } = require('./_setup/credentials.json');
const { regionExpectations } = require('./_setup/expectations');
describe('check user information', () => {
let connection;
beforeAll(() => {
connection = new ewelink({ email, password });
});
test('region should be returned', async () => {
const response = await connection.getRegion();
expect(response).toMatchObject(regionExpectations);
expect(typeof response).toBe('object');
expect(response.email).toBe(email);
expect(response.region).toBe(region);
});
});