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 2a446c6c7fe8ecf3dbe181209e92affe2b98c68d..a47c21f65fe31c30429f3d7379415c9ca499e4fb 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 @@ -10,6 +10,16 @@ describe('ExtApi-GetAppBaseInfo', () => { ] const numberProperties = [ 'uniCompilerVersionCode', 'uniRuntimeVersionCode' + ] + const booleanProperties = [ + 'isUniAppX' + ] + const requiredProperties = [ + 'uniCompilerVersion', + 'uniCompilerVersionCode', + 'uniRuntimeVersion', + 'uniRuntimeVersionCode', + 'isUniAppX' ] beforeAll(async () => { page = await program.reLaunch(PAGE_PATH) @@ -28,6 +38,16 @@ describe('ExtApi-GetAppBaseInfo', () => { expect(value).not.toBeNull(); expect(value).toBeGreaterThanOrEqual(3.90); } + if (booleanProperties.indexOf(key) != -1) { + expect(value).not.toBeNull(); + expect(typeof value).toBe('boolean'); + } } - }); + }); + it('Check GetSystemInfoSync required properties', async () => { + for (let i = 0; i < requiredProperties.length; i++) { + const key = requiredProperties[i] + expect(`${key} not null: ${res[key] != null}`).toBe(`${key} not null: true`) + } + }) }); 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 6f117c57e3d0dc4818a5ffe7ce31f36db31267a8..888aa8cdff3d1cc7987097cecb9effa1936be07d 100644 --- a/pages/API/get-system-info/get-system-info.test.js +++ b/pages/API/get-system-info/get-system-info.test.js @@ -15,6 +15,16 @@ describe('ExtApi-GetSystemInfo', () => { 'windowWidth', 'windowHeight', 'windowTop', 'windowBottom', 'screenTop', 'uniCompilerVersionCode', 'uniRuntimeVersionCode' + ] + const booleanProperties = [ + 'isUniAppX' + ] + const requiredProperties = [ + 'uniCompilerVersion', + 'uniCompilerVersionCode', + 'uniRuntimeVersion', + 'uniRuntimeVersionCode', + 'isUniAppX' ] beforeAll(async () => { @@ -34,6 +44,10 @@ describe('ExtApi-GetSystemInfo', () => { expect(value).not.toBeNull(); expect(value).toBeGreaterThanOrEqual(0); } + if (booleanProperties.indexOf(key) != -1) { + expect(value).not.toBeNull(); + expect(typeof value).toBe('boolean'); + } if (key == 'deviceOrientation') { expect(['portrait', 'landscape']).toContain(value); } @@ -41,5 +55,11 @@ describe('ExtApi-GetSystemInfo', () => { expect(['light', 'dark']).toContain(value); } } - }); + }); + it('Check GetSystemInfoSync required properties', async () => { + for (let i = 0; i < requiredProperties.length; i++) { + const key = requiredProperties[i] + expect(`${key} not null: ${res[key] != null}`).toBe(`${key} not null: true`) + } + }) });