import { createOptions, setupTokens, TestProjectId, TestTokens } from '../test.config'; import { ConfigGlobal } from '../api/configGlobal.service'; import { isEmpty } from 'lodash'; jest.setTimeout(10000); const factory = createOptions(); const service = new ConfigGlobal(factory); beforeAll(async () => { await setupTokens(); // console.log('tokens are loaded'); // console.log(TestTokens.zhulianToken); }); test('ConfigGlobal 00 获取用电量的ID', async () => { const deviceId = await service.loadElectricityDeviceId(TestProjectId); console.log('获取用电量的ID===', deviceId); expect(isEmpty(deviceId)).toBe(false); }); test('ConfigGlobal 01 设置用电量', async () => { const result = await service.loadElectricity(TestProjectId, '111', 2000); console.log('设置用电量 == ', result); expect(isEmpty(result)).toBe(false); }); test('ConfigGlobal 02 是否设置过电量,及获取初始值', async () => { const result = await service.loadElectricityInit(TestProjectId, '111'); console.log('是否设置过电量,及获取初始值==', result); expect(isEmpty(result)).toBe(false); }); test('ConfigGlobal 03 获取用水量', async () => { const result = await service.loadGetWaterMeter('e45e7f02-3038-45bf-a505-a91a8ff352dd'); console.log('获取的用水量==', result); }); test('ConfigGlobal 04 获取塔吊配置参数', async () => { const result = await service.loadCraneParam(TestProjectId); console.log('塔吊臂长==', result); }); test('ConfigGlobal 05 设置塔吊配置参数', async () => { const result = await service.postCraneParam(TestProjectId, 1.6); console.log('设置塔吊臂长结果==', result); });