From 7fa3a5b8342bc89906edd64a9fe671a8a4412cf8 Mon Sep 17 00:00:00 2001 From: caochuan Date: Thu, 10 Nov 2022 13:47:20 +0800 Subject: [PATCH] fix assert & add title modify testcase expect.assertFail() -> expect().assertFail() Signed-off-by: caochuan Change-Id: I837997cfcc741e8a5af198dff024a924f38bce62 --- .../test/mediaLibraryTestCallback.test.ets | 8 +- .../main/ets/test/fileTestCallback.test.ets | 6 +- .../main/ets/test/fileAssetCallback2.test.ets | 108 +++++++++++++++--- .../main/ets/test/fileAssetPromise2.test.ets | 103 ++++++++++++++--- .../ets/test/fileAssetTestCallback.test.ets | 16 +-- .../ets/test/fileAssetTestPromise.test.ets | 8 +- .../ets/test/getFileAssetsCallback.test.ets | 10 +- .../fileAssetCommitModifyCallback.test.ets | 2 +- .../ets/test/fileAssetOpenCallback.test.ets | 16 +-- .../ets/test/fileAssetOpenPromise.test.ets | 8 +- 10 files changed, 220 insertions(+), 65 deletions(-) diff --git a/multimedia/medialibrary/mediaLibrary_base/entry/src/main/ets/test/mediaLibraryTestCallback.test.ets b/multimedia/medialibrary/mediaLibrary_base/entry/src/main/ets/test/mediaLibraryTestCallback.test.ets index ff4da3097..0e0cff10c 100755 --- a/multimedia/medialibrary/mediaLibrary_base/entry/src/main/ets/test/mediaLibraryTestCallback.test.ets +++ b/multimedia/medialibrary/mediaLibrary_base/entry/src/main/ets/test/mediaLibraryTestCallback.test.ets @@ -133,7 +133,7 @@ export default function mediaLibraryTestCallback(abilityContext) { fetchFileResult.getFirstObject(async (err, asset) => { if (err) { console.info(`${testNum} err : ${err}`) - expect.assertFail(); + expect().assertFail(); done(); return; } @@ -181,7 +181,7 @@ export default function mediaLibraryTestCallback(abilityContext) { media.getPublicDirectory(dir, async (err, res) => { if (err) { console.info(`${testNum} err : ${err}`) - expect.assertFail(); + expect().assertFail(); done(); return; } @@ -219,7 +219,7 @@ export default function mediaLibraryTestCallback(abilityContext) { media.getFileAssets(fetchOps, async (err, fetchFileResult) => { if (err) { console.info(`${testNum} err : ${err}`) - expect.assertFail(); + expect().assertFail(); done(); return; } @@ -243,7 +243,7 @@ export default function mediaLibraryTestCallback(abilityContext) { media.createAsset(type, name, path, async (err, creatAsset) => { if (err) { console.info(`${testNum} err : ${err}`) - expect.assertFail(); + expect().assertFail(); done(); return; } diff --git a/multimedia/medialibrary/mediaLibrary_file/entry/src/main/ets/test/fileTestCallback.test.ets b/multimedia/medialibrary/mediaLibrary_file/entry/src/main/ets/test/fileTestCallback.test.ets index ef2805faa..506498478 100755 --- a/multimedia/medialibrary/mediaLibrary_file/entry/src/main/ets/test/fileTestCallback.test.ets +++ b/multimedia/medialibrary/mediaLibrary_file/entry/src/main/ets/test/fileTestCallback.test.ets @@ -69,7 +69,7 @@ export default function fileTestCallbackTest(abilityContext) { media.createAsset(type, displayName1, path, async (err, creatAsset1) => { if (err) { console.info(`${testNum} err : ${err}`) - expect.assertFail(); + expect().assertFail(); done(); return; } @@ -106,7 +106,7 @@ export default function fileTestCallbackTest(abilityContext) { media.createAsset(type, displayName, path, async (err, creatAsset) => { if (err) { console.info(`${testNum} err : ${err}`) - expect.assertFail(); + expect().assertFail(); done(); return; } @@ -138,7 +138,7 @@ export default function fileTestCallbackTest(abilityContext) { asset.commitModify(async (err) => { if (err) { console.info(`${testNum} err : ${err}`) - expect.assertFail(); + expect().assertFail(); done(); return; } diff --git a/multimedia/medialibrary/mediaLibrary_fileAsset/entry/src/main/ets/test/fileAssetCallback2.test.ets b/multimedia/medialibrary/mediaLibrary_fileAsset/entry/src/main/ets/test/fileAssetCallback2.test.ets index 609b3c7ec..8fa1c36fb 100755 --- a/multimedia/medialibrary/mediaLibrary_fileAsset/entry/src/main/ets/test/fileAssetCallback2.test.ets +++ b/multimedia/medialibrary/mediaLibrary_fileAsset/entry/src/main/ets/test/fileAssetCallback2.test.ets @@ -58,7 +58,7 @@ export default function fileAssetCallback2Test(abilityContext) { asset.commitModify(async (err) => { if (err) { console.info(`${testNum} err : ${err}`) - expect.assertFail(); + expect().assertFail(); done(); return; } @@ -96,7 +96,7 @@ export default function fileAssetCallback2Test(abilityContext) { done(); return; } - expect.assertFail(); + expect().assertFail(); done(); }); @@ -184,13 +184,14 @@ export default function fileAssetCallback2Test(abilityContext) { let testNum = 'SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_CALLBACK_005' let fetchOp = nameFetchOps(testNum, 'Pictures/ModifyCb/', '05', IMAGE_TYPE); let prop = 'displayName' - let newName = ""; + let val = ""; for (var i = 0; i < 83; i++) { - newName += "中"; + val += "中"; } - let val = newName + '.jpg' + val += ".jpg"; await checkCommitModify(done, testNum, fetchOp, prop, val) }); + /** * @tc.number : SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_CALLBACK_006 * @tc.name : commitModify @@ -203,14 +204,52 @@ export default function fileAssetCallback2Test(abilityContext) { let testNum = 'SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_CALLBACK_006' let fetchOp = nameFetchOps(testNum, 'Pictures/ModifyCb/', '06', IMAGE_TYPE); let prop = 'displayName' - let newName = ""; + let val = ""; for (var i = 0; i < 251; i++) { - newName += "a"; + val += "a"; } - let val = newName + '.jpg' + val += ".jpg"; await checkCommitModify(done, testNum, fetchOp, prop, val) }); + /** + * @tc.number : SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_CALLBACK_007 + * @tc.name : commitModify + * @tc.desc : Modify title '中中....' (85) + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it("SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_CALLBACK_007", 0, async function (done) { + let testNum = "SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_CALLBACK_007"; + let fetchOp = nameFetchOps(testNum, "Pictures/ModifyCb/", "07", IMAGE_TYPE); + let prop = "title"; + let val = ""; + for (var i = 0; i < 85; i++) { + val += "中"; + } + await checkCommitModify(done, testNum, fetchOp, prop, val); + }); + + /** + * @tc.number : SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_CALLBACK_008 + * @tc.name : commitModify + * @tc.desc : Modify title 'aaaaaaa....' (255) + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it("SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_CALLBACK_008", 0, async function (done) { + let testNum = "SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_CALLBACK_008"; + let fetchOp = nameFetchOps(testNum, "Pictures/ModifyCb/", "08", IMAGE_TYPE); + let prop = "title"; + let val = ""; + for (var i = 0; i < 255; i++) { + val += "a"; + } + await checkCommitModify(done, testNum, fetchOp, prop, val); + }); + /** * @tc.number : SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_CALLBACK_009 * @tc.name : commitModify @@ -223,13 +262,14 @@ export default function fileAssetCallback2Test(abilityContext) { let testNum = 'SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_CALLBACK_009' let fetchOp = nameFetchOps(testNum, 'Pictures/ModifyCb/', '09', IMAGE_TYPE); let prop = 'displayName' - let newName = ""; + let val = ""; for (var i = 0; i < 84; i++) { - newName += "中"; + val += "中"; } - let val = newName + '.jpg' + val += ".jpg"; await abnormalCheckCommitModify(done, testNum, fetchOp, prop, val) }); + /** * @tc.number : SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_CALLBACK_010 * @tc.name : commitModify @@ -242,14 +282,52 @@ export default function fileAssetCallback2Test(abilityContext) { let testNum = 'SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_CALLBACK_010' let fetchOp = nameFetchOps(testNum, 'Pictures/ModifyCb/', '010', IMAGE_TYPE); let prop = 'displayName' - let newName = ""; + let val = ""; for (var i = 0; i < 252; i++) { - newName += "a"; + val += "a"; } - let val = newName + '.jpg' + val += ".jpg"; await abnormalCheckCommitModify(done, testNum, fetchOp, prop, val) }); + /** + * @tc.number : SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_CALLBACK_011 + * @tc.name : commitModify + * @tc.desc : Modify title '中中....' (86) + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it("SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_CALLBACK_011", 0, async function (done) { + let testNum = "SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_CALLBACK_011"; + let fetchOp = nameFetchOps(testNum, "Pictures/ModifyCb/", "011", IMAGE_TYPE); + let prop = "title"; + let val = ""; + for (var i = 0; i < 86; i++) { + val += "中"; + } + await abnormalCheckCommitModify(done, testNum, fetchOp, prop, val); + }); + + /** + * @tc.number : SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_CALLBACK_012 + * @tc.name : commitModify + * @tc.desc : Modify title 'aaaaaaa....' (256) + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it("SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_CALLBACK_012", 0, async function (done) { + let testNum = "SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_CALLBACK_012"; + let fetchOp = nameFetchOps(testNum, "Pictures/ModifyCb/", "012", IMAGE_TYPE); + let prop = "title"; + let val = ""; + for (var i = 0; i < 256; i++) { + val += "a"; + } + await abnormalCheckCommitModify(done, testNum, fetchOp, prop, val); + }); + /** * @tc.number : SUB_MEDIA_MEDIALIBRARY_FILEASSET_ISDIRECTORY_CALLBACK_001 * @tc.name : isDirectory @@ -267,7 +345,7 @@ export default function fileAssetCallback2Test(abilityContext) { asset.isDirectory((err, isDir) =>{ if (err) { console.info(`${testNum} err : ${err}`); - expect.assertFail(); + expect().assertFail(); done(); return; } diff --git a/multimedia/medialibrary/mediaLibrary_fileAsset/entry/src/main/ets/test/fileAssetPromise2.test.ets b/multimedia/medialibrary/mediaLibrary_fileAsset/entry/src/main/ets/test/fileAssetPromise2.test.ets index 1e7b7d351..3846e1574 100755 --- a/multimedia/medialibrary/mediaLibrary_fileAsset/entry/src/main/ets/test/fileAssetPromise2.test.ets +++ b/multimedia/medialibrary/mediaLibrary_fileAsset/entry/src/main/ets/test/fileAssetPromise2.test.ets @@ -103,7 +103,7 @@ export default function fileAssetPromise2Test(abilityContext) { asset[prop] = val; try { await asset.commitModify(); - expect.assertFail(); + expect().assertFail(); done(); } catch (error) { console.info(`${testNum} passed : ${error}`) @@ -193,13 +193,14 @@ export default function fileAssetPromise2Test(abilityContext) { let testNum = 'SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_PROMISE_005' let fetchOp = nameFetchOps(testNum, 'Pictures/ModifyPro/', '05', IMAGE_TYPE); let prop = 'displayName' - let newName = ""; + let val = ""; for (var i = 0; i < 83; i++) { - newName += "中"; + val += "中"; } - let val = newName + '.jpg' + val += ".jpg"; await checkCommitModify(done, testNum, fetchOp, prop, val) }); + /** * @tc.number : SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_PROMISE_006 * @tc.name : commitModify @@ -212,14 +213,52 @@ export default function fileAssetPromise2Test(abilityContext) { let testNum = 'SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_PROMISE_006' let fetchOp = nameFetchOps(testNum, 'Pictures/ModifyPro/', '06', IMAGE_TYPE); let prop = 'displayName' - let newName = ""; + let val = ""; for (var i = 0; i < 251; i++) { - newName += "a"; + val += "a"; + } + val += ".jpg"; + await checkCommitModify(done, testNum, fetchOp, prop, val) + }); + + /** + * @tc.number : SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_PROMISE_007 + * @tc.name : commitModify + * @tc.desc : Modify title '中中....' (85) + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_PROMISE_007', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_PROMISE_007' + let fetchOp = nameFetchOps(testNum, 'Pictures/ModifyPro/', '07', IMAGE_TYPE); + let prop = 'title' + let val = ""; + for (var i = 0; i < 85; i++) { + val += "中"; } - let val = newName + '.jpg' await checkCommitModify(done, testNum, fetchOp, prop, val) }); + /** + * @tc.number : SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_PROMISE_008 + * @tc.name : title + * @tc.desc : Modify title 'aaaaaaa....' (255) + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it("SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_PROMISE_008", 0, async function (done) { + let testNum = "SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_PROMISE_008"; + let fetchOp = nameFetchOps(testNum, "Pictures/ModifyPro/", "08", IMAGE_TYPE); + let prop = "title"; + let val = ""; + for (var i = 0; i < 255; i++) { + val += "a"; + } + await checkCommitModify(done, testNum, fetchOp, prop, val); + }); + /** * @tc.number : SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_PROMISE_009 * @tc.name : commitModify @@ -232,13 +271,14 @@ export default function fileAssetPromise2Test(abilityContext) { let testNum = 'SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_PROMISE_009' let fetchOp = nameFetchOps(testNum, 'Pictures/ModifyPro/', '09', IMAGE_TYPE); let prop = 'displayName' - let newName = ""; + let val = ""; for (var i = 0; i < 84; i++) { - newName += "中"; + val += "中"; } - let val = newName + '.jpg' + val += ".jpg"; await abnormalCheckCommitModify(done, testNum, fetchOp, prop, val) }); + /** * @tc.number : SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_PROMISE_010 * @tc.name : commitModify @@ -251,14 +291,51 @@ export default function fileAssetPromise2Test(abilityContext) { let testNum = 'SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_PROMISE_010' let fetchOp = nameFetchOps(testNum, 'Pictures/ModifyPro/', '010', IMAGE_TYPE); let prop = 'displayName' - let newName = ""; + let val = ""; for (var i = 0; i < 252; i++) { - newName += "a"; + val += "a"; } - let val = newName + '.jpg' + val += ".jpg"; await abnormalCheckCommitModify(done, testNum, fetchOp, prop, val) }); + /** + * @tc.number : SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_PROMISE_011 + * @tc.name : commitModify + * @tc.desc : Modify title '中中....' (86) + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it("SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_PROMISE_011", 0, async function (done) { + let testNum = "SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_PROMISE_011"; + let fetchOp = nameFetchOps(testNum, "Pictures/ModifyPro/", "011", IMAGE_TYPE); + let prop = "title"; + let val = ""; + for (var i = 0; i < 86; i++) { + val += "中"; + } + await abnormalCheckCommitModify(done, testNum, fetchOp, prop, val); + }); + + /** + * @tc.number : SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_PROMISE_012 + * @tc.name : commitModify + * @tc.desc : Modify title 'aaaaaaa....' (256) + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it("SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_PROMISE_012", 0, async function (done) { + let testNum = "SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_PROMISE_012"; + let fetchOp = nameFetchOps(testNum, "Pictures/ModifyPro/", "012", IMAGE_TYPE); + let prop = "title"; + let val = ""; + for (var i = 0; i < 256; i++) { + val += "a"; + } + await abnormalCheckCommitModify(done, testNum, fetchOp, prop, val); + }); /** * @tc.number : SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_PROMISE_02_001 diff --git a/multimedia/medialibrary/mediaLibrary_fileAsset/entry/src/main/ets/test/fileAssetTestCallback.test.ets b/multimedia/medialibrary/mediaLibrary_fileAsset/entry/src/main/ets/test/fileAssetTestCallback.test.ets index 289f17aa1..45707f463 100755 --- a/multimedia/medialibrary/mediaLibrary_fileAsset/entry/src/main/ets/test/fileAssetTestCallback.test.ets +++ b/multimedia/medialibrary/mediaLibrary_fileAsset/entry/src/main/ets/test/fileAssetTestCallback.test.ets @@ -56,7 +56,7 @@ export default function fileAssetTestCallbackTest(abilityContext) { asset.open('rw', async (err, fd) => { if (err) { console.info(`${testNum} :: err: ${err}`); - expect.assertFail(); + expect().assertFail(); done(); return; } @@ -88,7 +88,7 @@ export default function fileAssetTestCallbackTest(abilityContext) { console.info(`${testNum} :: error: ${error}`); await asset.close(fd); await asset1.close(fd1); - expect.assertFail(); + expect().assertFail(); done(); } } @@ -104,7 +104,7 @@ export default function fileAssetTestCallbackTest(abilityContext) { asset.open('r', async (err, fd) => { if (err) { console.info(`${testNum} :: err: ${err}`); - expect.assertFail(); + expect().assertFail(); done(); return; } @@ -115,7 +115,7 @@ export default function fileAssetTestCallbackTest(abilityContext) { expect(res.bytesRead).assertEqual(assetProps.bytesRead); try { await fileio.write(fd, buf); - expect.assertFail(); + expect().assertFail(); } catch (error) { expect(true).assertTrue(); await asset.close(fd); @@ -125,7 +125,7 @@ export default function fileAssetTestCallbackTest(abilityContext) { } catch (error) { console.info(`${testNum} :: error: ${error}`); - expect.assertFail(); + expect().assertFail(); await asset.close(fd); done(); } @@ -146,7 +146,7 @@ export default function fileAssetTestCallbackTest(abilityContext) { asset.open('w', async (err, fd) => { if (err) { console.info(`${testNum} :: err: ${err}`); - expect.assertFail(); + expect().assertFail(); done(); return; } @@ -160,7 +160,7 @@ export default function fileAssetTestCallbackTest(abilityContext) { let buf1 = new ArrayBuffer(4096); try { await fileio.read(fd, buf1); - expect.assertFail(); + expect().assertFail(); } catch (error) { expect(true).assertTrue(); @@ -191,7 +191,7 @@ export default function fileAssetTestCallbackTest(abilityContext) { asset.close(fd, async (err) => { if (err) { console.info(`${testNum} :: err: ${err}`); - expect.assertFail(); + expect().assertFail(); done(); return; } diff --git a/multimedia/medialibrary/mediaLibrary_fileAsset/entry/src/main/ets/test/fileAssetTestPromise.test.ets b/multimedia/medialibrary/mediaLibrary_fileAsset/entry/src/main/ets/test/fileAssetTestPromise.test.ets index 7a14e3ba7..3c3b14f38 100755 --- a/multimedia/medialibrary/mediaLibrary_fileAsset/entry/src/main/ets/test/fileAssetTestPromise.test.ets +++ b/multimedia/medialibrary/mediaLibrary_fileAsset/entry/src/main/ets/test/fileAssetTestPromise.test.ets @@ -80,7 +80,7 @@ export default function fileAssetTestPromiseTest(abilityContext) { console.info(`${testNum} :: error: ${error}`); await asset.close(fd); await asset1.close(fd1); - expect.assertFail(); + expect().assertFail(); done(); } } @@ -101,7 +101,7 @@ export default function fileAssetTestPromiseTest(abilityContext) { expect(res.bytesRead).assertEqual(assetProps.bytesRead); try { await fileio.write(fd, buf); - expect.assertFail(); + expect().assertFail(); } catch (error) { expect(true).assertTrue(); await asset.close(fd); @@ -109,7 +109,7 @@ export default function fileAssetTestPromiseTest(abilityContext) { } } catch (error) { console.info(`${testNum} :: error: ${error}`); - expect.assertFail(); + expect().assertFail(); await asset.close(fd); done(); } @@ -138,7 +138,7 @@ export default function fileAssetTestPromiseTest(abilityContext) { let buf1 = new ArrayBuffer(4096); try { await fileio.read(fd, buf1); - expect.assertFail(); + expect().assertFail(); } catch (error) { expect(true).assertTrue(); diff --git a/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/getFileAssetsCallback.test.ets b/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/getFileAssetsCallback.test.ets index ef7e9cc96..bceebef1d 100644 --- a/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/getFileAssetsCallback.test.ets +++ b/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/getFileAssetsCallback.test.ets @@ -75,7 +75,7 @@ export default function getFileAssetsCallbackTest(abilityContext) { fetchAssetResult.getFirstObject(async (err, asset) => { if (err) { console.info(`${testNum} err : ${err}`) - expect.assertFail(); + expect().assertFail(); fetchAssetResult.close(); done(); return; @@ -106,7 +106,7 @@ export default function getFileAssetsCallbackTest(abilityContext) { fetchAssetResult.getNextObject(async (err, asset) => { if (err) { console.info(`${testNum} err : ${err}`) - expect.assertFail(); + expect().assertFail(); fetchAssetResult.close(); done(); return; @@ -136,7 +136,7 @@ export default function getFileAssetsCallbackTest(abilityContext) { fetchAssetResult.getLastObject(async (err, asset) => { if (err) { console.info(`${testNum} err : ${err}`) - expect.assertFail(); + expect().assertFail(); fetchAssetResult.close(); done(); return; @@ -166,7 +166,7 @@ export default function getFileAssetsCallbackTest(abilityContext) { fetchAssetResult.getPositionObject(pos, async (err, asset) => { if (err) { console.info(`${testNum} err : ${err}`) - expect.assertFail(); + expect().assertFail(); fetchAssetResult.close(); done(); return; @@ -263,7 +263,7 @@ export default function getFileAssetsCallbackTest(abilityContext) { fetchAssetResult.getFirstObject((err, asset) => { if (err) { console.info(`${testNum} err : ${err}`) - expect.assertFail(); + expect().assertFail(); fetchAssetResult.close(); done(); return; diff --git a/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetCommitModifyCallback.test.ets b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetCommitModifyCallback.test.ets index 8169ce24c..c6b895bed 100755 --- a/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetCommitModifyCallback.test.ets +++ b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetCommitModifyCallback.test.ets @@ -67,7 +67,7 @@ export default function fileAssetCommitModifyCallbackTest(abilityContext) { await asset.commitModify(async (err) => { if (err) { console.info(`${testNum} err : ${err}`) - expect.assertFail(); + expect().assertFail(); done(); return; } diff --git a/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetOpenCallback.test.ets b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetOpenCallback.test.ets index b6f5dcfac..2a4c78e36 100755 --- a/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetOpenCallback.test.ets +++ b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetOpenCallback.test.ets @@ -60,7 +60,7 @@ export default function fileAssetOpenCallbackTest(abilityContext) { asset.open('r', async (err, fd) => { if (err) { console.info(`${testNum} :: err: ${err}`); - expect.assertFail(); + expect().assertFail(); done(); return; } @@ -71,7 +71,7 @@ export default function fileAssetOpenCallbackTest(abilityContext) { expect(res.bytesRead).assertEqual(assetProps.bytesRead); try { await fileio.write(fd, buf); - expect.assertFail(); + expect().assertFail(); } catch (error) { expect(true).assertTrue(); await asset.close(fd); @@ -80,7 +80,7 @@ export default function fileAssetOpenCallbackTest(abilityContext) { }); } catch (error) { console.info(`${testNum} :: error: ${error}`); - expect.assertFail(); + expect().assertFail(); await asset.close(fd); done(); } @@ -104,7 +104,7 @@ export default function fileAssetOpenCallbackTest(abilityContext) { asset.open('w', async (err, fd) => { if (err) { console.info(`${testNum} :: err: ${err}`); - expect.assertFail(); + expect().assertFail(); done(); return; } @@ -118,7 +118,7 @@ export default function fileAssetOpenCallbackTest(abilityContext) { let buf1 = new ArrayBuffer(4096); try { await fileio.read(fd, buf1); - expect.assertFail(); + expect().assertFail(); } catch (error) { expect(true).assertTrue(); } @@ -149,7 +149,7 @@ export default function fileAssetOpenCallbackTest(abilityContext) { asset.open('rw', async (err, fd) => { if (err) { console.info(`${testNum} :: err: ${err}`); - expect.assertFail(); + expect().assertFail(); done(); return; } @@ -175,7 +175,7 @@ export default function fileAssetOpenCallbackTest(abilityContext) { console.info(`${testNum} :: error: ${error}`); await asset.close(fd); await asset1.close(fd1); - expect.assertFail(); + expect().assertFail(); done(); } } @@ -198,7 +198,7 @@ export default function fileAssetOpenCallbackTest(abilityContext) { asset.close(fd, async (err) => { if (err) { console.info(`${testNum} :: err: ${err}`); - expect.assertFail(); + expect().assertFail(); done(); return; } diff --git a/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetOpenPromise.test.ets b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetOpenPromise.test.ets index 5c46c74d6..0dc81d060 100755 --- a/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetOpenPromise.test.ets +++ b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetOpenPromise.test.ets @@ -66,7 +66,7 @@ export default function fileAssetOpenPromiseTest(abilityContext) { expect(res.bytesRead).assertEqual(assetProps.bytesRead); try { await fileio.write(fd, buf); - expect.assertFail(); + expect().assertFail(); } catch (error) { expect(true).assertTrue(); await asset.close(fd); @@ -74,7 +74,7 @@ export default function fileAssetOpenPromiseTest(abilityContext) { } } catch (error) { console.info(`${testNum} :: error: ${error}`); - expect.assertFail(); + expect().assertFail(); await asset.close(fd); done(); } @@ -107,7 +107,7 @@ export default function fileAssetOpenPromiseTest(abilityContext) { let buf1 = new ArrayBuffer(4096); try { await fileio.read(fd, buf1); - expect.assertFail(); + expect().assertFail(); } catch (error) { expect(true).assertTrue(); @@ -158,7 +158,7 @@ export default function fileAssetOpenPromiseTest(abilityContext) { console.info(`${testNum} :: error: ${error}`); await asset.close(fd); await asset1.close(fd1); - expect.assertFail(); + expect().assertFail(); done(); } } -- GitLab