From 96f630a6d15c54ccb063e2ec9b2687f0b6223365 Mon Sep 17 00:00:00 2001 From: taohebin Date: Tue, 26 Sep 2023 17:12:30 +0800 Subject: [PATCH] =?UTF-8?q?fix:=201.=20=E4=BF=AE=E6=94=B9=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E7=94=A8=E4=BE=8B=202.=20=E5=8E=BB=E9=99=A4warning?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../API/get-app-base-info/get-app-base-info.test.js | 10 ++++++---- pages/API/get-device-info/get-device-info.test.js | 12 +++++++----- pages/API/get-system-info/get-system-info.test.js | 6 ++++-- pages/API/get-system-setting/get-system-setting.uvue | 4 ++-- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/pages/API/get-app-base-info/get-app-base-info.test.js b/pages/API/get-app-base-info/get-app-base-info.test.js index b0a255f3..4c61b7bf 100644 --- a/pages/API/get-app-base-info/get-app-base-info.test.js +++ b/pages/API/get-app-base-info/get-app-base-info.test.js @@ -18,12 +18,14 @@ describe('ExtApi-GetAppBaseInfo', () => { }); it('Check properties', async () => { for (const key in res) { - const value = res[key]; - expect(value).not.toBeNull(); - if (stringProperties.indexOf(key) != -1) { + const value = res[key]; + console.log("key :",key , "value :", value); + if (stringProperties.indexOf(key) != -1) { + expect(value).not.toBeNull(); expect(value).not.toBe(""); } - if (numberProperties.indexOf(key) != -1) { + if (numberProperties.indexOf(key) != -1) { + expect(value).not.toBeNull(); expect(value).toBeGreaterThanOrEqual(3.90); } } diff --git a/pages/API/get-device-info/get-device-info.test.js b/pages/API/get-device-info/get-device-info.test.js index 6776ab30..d0027337 100644 --- a/pages/API/get-device-info/get-device-info.test.js +++ b/pages/API/get-device-info/get-device-info.test.js @@ -13,14 +13,16 @@ describe('ExtApi-GetDeviceInfo', () => { await page.waitFor(600); res = await uni.getDeviceInfo(); }); - it('Check properties', async () => { + it('Check properties', async () => { for (const key in res) { - const value = res[key]; - expect(value).not.toBeNull(); - if (stringProperties.indexOf(key) != -1) { + const value = res[key]; + console.log("key :",key , "value :", value); + if (stringProperties.indexOf(key) != -1) { + expect(value).not.toBeNull(); expect(value).not.toBe(""); } - if (key == 'deviceOrientation') { + if (key == 'deviceOrientation') { + expect(value).not.toBeNull(); expect(['portrait', 'landscape']).toContain(value); } } diff --git a/pages/API/get-system-info/get-system-info.test.js b/pages/API/get-system-info/get-system-info.test.js index 7e9685bf..5a614780 100644 --- a/pages/API/get-system-info/get-system-info.test.js +++ b/pages/API/get-system-info/get-system-info.test.js @@ -25,11 +25,13 @@ describe('ExtApi-GetSystemInfo', () => { it('Check GetSystemInfoSync', async () => { for (const key in res) { const value = res[key]; - expect(value).not.toBeNull(); + console.log("key :",key , "value :", value); if (stringProperties.indexOf(key) != -1) { + expect(value).not.toBeNull(); expect(value).not.toBe(""); } if (numberProperties.indexOf(key) != -1) { + expect(value).not.toBeNull(); expect(value).toBeGreaterThanOrEqual(0); } if (key == 'deviceOrientation') { @@ -37,4 +39,4 @@ describe('ExtApi-GetSystemInfo', () => { } } }); -}); \ No newline at end of file +}); diff --git a/pages/API/get-system-setting/get-system-setting.uvue b/pages/API/get-system-setting/get-system-setting.uvue index b3d348ea..253d6e0d 100644 --- a/pages/API/get-system-setting/get-system-setting.uvue +++ b/pages/API/get-system-setting/get-system-setting.uvue @@ -61,9 +61,9 @@ getSystemSetting: function () { const res = uni.getSystemSetting(); this.bluetoothEnabled = (res.bluetoothEnabled ?? false) ? "开启" : "关闭"; - this.locationEnabled = (res.locationEnabled ?? false) ? "开启" : "关闭"; + this.locationEnabled = res.locationEnabled ? "开启" : "关闭"; this.wifiEnabled = (res.wifiEnabled ?? false) ? "开启" : "关闭"; - this.deviceOrientation = res.deviceOrientation ?? ""; + this.deviceOrientation = res.deviceOrientation } } } -- GitLab