From 9ac04d95883790ebca5abffdcabc59fa6bb80287 Mon Sep 17 00:00:00 2001 From: zhangyushuai Date: Fri, 28 Jul 2023 08:53:06 +0000 Subject: [PATCH] =?UTF-8?q?fixed=20674e3b5=20from=20https://gitee.com/murp?= =?UTF-8?q?hy1984/acts/pulls/9569=20request=20taskinfo=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=E5=80=BC=E8=A6=86=E7=9B=96=20002?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhangyushuai --- .../main/ets/test/requestDownload.test.ets | 1 + .../main/ets/test/requestDownload002.test.ets | 35 +++++++++++++++++-- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/request/newRequestAuthorityTest/entry/src/main/ets/test/requestDownload.test.ets b/request/newRequestAuthorityTest/entry/src/main/ets/test/requestDownload.test.ets index a90b9c997..1ebedeea4 100644 --- a/request/newRequestAuthorityTest/entry/src/main/ets/test/requestDownload.test.ets +++ b/request/newRequestAuthorityTest/entry/src/main/ets/test/requestDownload.test.ets @@ -140,6 +140,7 @@ export default function requestDownloadJSUnit() { expect().assertFail(); } expect(task !== undefined).assertEqual(true); + expect(typeof(task.config) === "object").assertEqual(true); console.info("====>SUB_Misc_REQUEST_Create_Download_Callback_0010 create success: " + task); }catch(error){ console.info("====>SUB_Misc_REQUEST_Create_Download_Callback_0010 create fail: " + JSON.stringify(error)); diff --git a/request/newRequestAuthorityTest/entry/src/main/ets/test/requestDownload002.test.ets b/request/newRequestAuthorityTest/entry/src/main/ets/test/requestDownload002.test.ets index 41ff4cf59..f5a35dad0 100755 --- a/request/newRequestAuthorityTest/entry/src/main/ets/test/requestDownload002.test.ets +++ b/request/newRequestAuthorityTest/entry/src/main/ets/test/requestDownload002.test.ets @@ -1220,6 +1220,23 @@ export default function requestDownloadTwoUnitTest() { expect(taskInfo.bundle).assertEqual(undefined); expect(taskInfo.url).assertEqual(config.url); expect(taskInfo.data).assertEqual(""); + + console.info('====>SUB_Misc_REQUEST_Show_Promise_0010 taskInfo.saveas: ' + taskInfo.saveas); + console.info('====>SUB_Misc_REQUEST_Show_Promise_0010 taskInfo.tid: ' + typeof taskInfo.tid); + console.info('====>SUB_Misc_REQUEST_Show_Promise_0010 taskInfo.description: ' + taskInfo.description); + console.info('====>SUB_Misc_REQUEST_Show_Promise_0010 taskInfo.action: ' + taskInfo.action); + console.info('====>SUB_Misc_REQUEST_Show_Promise_0010 taskInfo.mode: ' + taskInfo.mode); + console.info('====>SUB_Misc_REQUEST_Show_Promise_0010 taskInfo.gauge: ' + taskInfo.gauge); + console.info('====>SUB_Misc_REQUEST_Show_Promise_0010 taskInfo.mtime: ' + taskInfo.mtime); + console.info('====>SUB_Misc_REQUEST_Show_Promise_0010 taskInfo.extras: ' + taskInfo.extras); + expect(typeof(taskInfo.saveas) === 'string').assertTrue(); + expect(typeof(taskInfo.tid) === 'string').assertTrue(); + expect(taskInfo.description).assertEqual(""); + expect(taskInfo.action).assertEqual(0); + expect(taskInfo.mode).assertEqual(1); + expect(taskInfo.gauge === false).assertTrue(); + expect(typeof(taskInfo.mtime) === 'number').assertTrue(); + expect(typeof(taskInfo.extras) === 'object').assertTrue(); done(); }catch(err){ console.debug('====>SUB_Misc_REQUEST_Show_Callback_0010 show throw_err:' + JSON.stringify(err)); @@ -1267,10 +1284,24 @@ export default function requestDownloadTwoUnitTest() { expect(taskInfo.uid).assertEqual(undefined); expect(taskInfo.bundle).assertEqual(undefined); expect(taskInfo.title).assertEqual(config.title); + + console.info('====>SUB_Misc_REQUEST_Show_Promise_0010 taskInfo.mimeType: ' + taskInfo.mimeType); + console.info('====>SUB_Misc_REQUEST_Show_Promise_0010 taskInfo.progress: ' + taskInfo.progress); + console.info('====>SUB_Misc_REQUEST_Show_Promise_0010 taskInfo.ctime: ' + taskInfo.ctime); + console.info('====>SUB_Misc_REQUEST_Show_Promise_0010 taskInfo.tries: ' + taskInfo.tries); + console.info('====>SUB_Misc_REQUEST_Show_Promise_0010 taskInfo.faults: ' + taskInfo.faults); + console.info('====>SUB_Misc_REQUEST_Show_Promise_0010 taskInfo.reason: ' + taskInfo.reason); + console.info('====>SUB_Misc_REQUEST_Show_Promise_0010 taskInfo.retry: ' + taskInfo.retry); + expect(taskInfo.mimeType).assertEqual(''); + expect(typeof(taskInfo.progress) === 'object').assertTrue(); + expect(typeof(taskInfo.ctime) === 'number').assertTrue(); + expect(taskInfo.tries).assertLargerOrEqual(0); + expect(taskInfo.faults).assertEqual(null); + expect(taskInfo.reason).assertContain('Task successful'); + expect(typeof(taskInfo.retry) === 'boolean').assertTrue(); done(); }catch(err){ console.debug('====>SUB_Misc_REQUEST_Show_Promise_0010 show throw_err:' + JSON.stringify(err)); - expect().assertFail(); done(); }; }; @@ -1946,7 +1977,6 @@ export default function requestDownloadTwoUnitTest() { done(); }catch(err){ console.debug('====>SUB_Misc_REQUEST_Touch_Promise_0010 touch throw_err:' + JSON.stringify(err)); - expect().assertFail(); done(); } } @@ -2092,7 +2122,6 @@ export default function requestDownloadTwoUnitTest() { }) }catch(err){ console.debug('====>SUB_Misc_REQUEST_Touch_Callback_0040 touch throw_err:' + JSON.stringify(err)); - expect().assertFail(); done(); } } -- GitLab