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

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

上级 367bafe8
...@@ -11,6 +11,16 @@ describe('ExtApi-GetAppBaseInfo', () => { ...@@ -11,6 +11,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)
await page.waitFor(600); await page.waitFor(600);
...@@ -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`)
}
})
}); });
...@@ -16,6 +16,16 @@ describe('ExtApi-GetSystemInfo', () => { ...@@ -16,6 +16,16 @@ describe('ExtApi-GetSystemInfo', () => {
'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 () => {
page = await program.reLaunch(PAGE_PATH) page = await program.reLaunch(PAGE_PATH)
...@@ -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);
} }
...@@ -42,4 +56,10 @@ describe('ExtApi-GetSystemInfo', () => { ...@@ -42,4 +56,10 @@ describe('ExtApi-GetSystemInfo', () => {
} }
} }
}); });
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.
先完成此消息的编辑!
想要评论请 注册