提交 3efb4a5f 编写于 作者: 雪洛's avatar 雪洛

test: 增加appBaseInfo、systemInfo必备属性测试

上级 367bafe8
...@@ -10,6 +10,16 @@ describe('ExtApi-GetAppBaseInfo', () => { ...@@ -10,6 +10,16 @@ describe('ExtApi-GetAppBaseInfo', () => {
] ]
const numberProperties = [ const numberProperties = [
'uniCompilerVersionCode', 'uniRuntimeVersionCode' 'uniCompilerVersionCode', 'uniRuntimeVersionCode'
]
const booleanProperties = [
'isUniAppX'
]
const requiredProperties = [
'uniCompilerVersion',
'uniCompilerVersionCode',
'uniRuntimeVersion',
'uniRuntimeVersionCode',
'isUniAppX'
] ]
beforeAll(async () => { beforeAll(async () => {
page = await program.reLaunch(PAGE_PATH) page = await program.reLaunch(PAGE_PATH)
...@@ -28,6 +38,16 @@ describe('ExtApi-GetAppBaseInfo', () => { ...@@ -28,6 +38,16 @@ describe('ExtApi-GetAppBaseInfo', () => {
expect(value).not.toBeNull(); expect(value).not.toBeNull();
expect(value).toBeGreaterThanOrEqual(3.90); 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`)
}
})
}); });
...@@ -15,6 +15,16 @@ describe('ExtApi-GetSystemInfo', () => { ...@@ -15,6 +15,16 @@ describe('ExtApi-GetSystemInfo', () => {
'windowWidth', 'windowWidth',
'windowHeight', 'windowTop', 'windowBottom', 'screenTop', 'windowHeight', 'windowTop', 'windowBottom', 'screenTop',
'uniCompilerVersionCode', 'uniRuntimeVersionCode' 'uniCompilerVersionCode', 'uniRuntimeVersionCode'
]
const booleanProperties = [
'isUniAppX'
]
const requiredProperties = [
'uniCompilerVersion',
'uniCompilerVersionCode',
'uniRuntimeVersion',
'uniRuntimeVersionCode',
'isUniAppX'
] ]
beforeAll(async () => { beforeAll(async () => {
...@@ -34,6 +44,10 @@ describe('ExtApi-GetSystemInfo', () => { ...@@ -34,6 +44,10 @@ describe('ExtApi-GetSystemInfo', () => {
expect(value).not.toBeNull(); expect(value).not.toBeNull();
expect(value).toBeGreaterThanOrEqual(0); expect(value).toBeGreaterThanOrEqual(0);
} }
if (booleanProperties.indexOf(key) != -1) {
expect(value).not.toBeNull();
expect(typeof value).toBe('boolean');
}
if (key == 'deviceOrientation') { if (key == 'deviceOrientation') {
expect(['portrait', 'landscape']).toContain(value); expect(['portrait', 'landscape']).toContain(value);
} }
...@@ -41,5 +55,11 @@ describe('ExtApi-GetSystemInfo', () => { ...@@ -41,5 +55,11 @@ describe('ExtApi-GetSystemInfo', () => {
expect(['light', 'dark']).toContain(value); 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`)
}
})
}); });
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册