mirror of
https://github.com/skydiver/ewelink-api.git
synced 2025-12-31 01:57:23 +01:00
* helper method to login into ewelink if no auth credentials found * return websocket reponse as JSON * created function to get raw consumption data * created function to parse raw consumption data and return daily usage * renamed property * created function to get current month power usage * created function to get raw power usage * added new test cases * catch websocket connection errors * power usage enhancements * added new test case * removed unused code * updated credentials file * version bump * updated dependencies * tests reorganized
44 lines
941 B
JavaScript
44 lines
941 B
JavaScript
const loginExpectations = {
|
|
at: expect.any(String),
|
|
user: { email: expect.any(String) },
|
|
region: expect.any(String),
|
|
};
|
|
|
|
const allDevicesExpectations = {
|
|
name: expect.any(String),
|
|
deviceid: expect.any(String),
|
|
apikey: expect.any(String),
|
|
params: expect.any(Object),
|
|
showBrand: expect.any(Boolean),
|
|
uiid: expect.any(Number),
|
|
};
|
|
|
|
const specificDeviceExpectations = {
|
|
name: expect.any(String),
|
|
deviceid: expect.any(String),
|
|
apikey: expect.any(String),
|
|
online: expect.any(Boolean),
|
|
uiid: expect.any(Number),
|
|
};
|
|
|
|
const rawPowerUsageExpectations = {
|
|
status: 'ok',
|
|
data: {
|
|
hundredDaysKwhData: expect.any(String),
|
|
},
|
|
};
|
|
|
|
const currentMonthPowerUsageExpectations = {
|
|
status: 'ok',
|
|
monthly: expect.any(Number),
|
|
daily: expect.any(Array),
|
|
};
|
|
|
|
module.exports = {
|
|
loginExpectations,
|
|
allDevicesExpectations,
|
|
specificDeviceExpectations,
|
|
rawPowerUsageExpectations,
|
|
currentMonthPowerUsageExpectations,
|
|
};
|