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

test: 增加request返回数组的测试例

上级 aa186020
......@@ -83,7 +83,13 @@ describe('ExtApi-Request', () => {
await page.waitFor(2000);
res = await page.data('jest_result');
expect(res).toBe(true)
});
});
it('Get Array', async () => {
res = await page.callMethod('jest_get_array')
await page.waitFor(2000);
res = await page.data('jest_result');
expect(res).toBe(true)
})
let shouldTestCookie = false
if (process.env.uniTestPlatformInfo.startsWith('android') && !process.env.UNI_AUTOMATOR_APP_WEBVIEW) {
......
......@@ -340,6 +340,22 @@
this.jest_result = false;
},
});
},
jest_get_array() {
uni.request<UTSJSONObject[]>({
url: 'https://unidemo.dcloud.net.cn/api/news?column=title,author_name,cover,published_at',
method: "GET",
success: (res : RequestSuccess<UTSJSONObject[]>) => {
if (res.statusCode == 200 && Array.isArray(res.data)) {
this.jest_result = true
} else {
this.jest_result = false
}
},
complete: () => {
this.jest_result = false
}
});
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册