diff --git a/storage/storagefilejstest/src/main/js/test/File.test.js b/storage/storagefilejstest/src/main/js/test/File.test.js index 46d045cee79578b0f157ac9cf8e99155dd39093a..99aaa3bd47f88ec7cf5660c8e49108731bf57db1 100644 --- a/storage/storagefilejstest/src/main/js/test/File.test.js +++ b/storage/storagefilejstest/src/main/js/test/File.test.js @@ -15,6 +15,7 @@ import fileio from '@ohos.fileio'; import file from '@system.file'; +import document from '@ohos.document'; import { describe, it, @@ -3823,5 +3824,114 @@ describe('fileTest', function () { } }); }); + /** + * @tc.number SUB_STORAGE_Document_Choose_0100 + * @tc.name Document_Choose_001 + * @tc.desc Function of API, choose file.The test file is exist. + */ + it('File_Document_Choose_001', 0, async function (done) { + try { + let types = []; + let code = await document.choose(types); + let str = 'Error'; + console.info("getFileUri===>" + code); + expect(str).assertTrue(); + done(); + } + catch (e) { + console.info('File_Document_Choose_001 has failed for ' + e.message); + expect(e.message == "error").assertTrue(); + done(); + } + }); + + /** + * @tc.number SUB_STORAGE_Document_Choose_0200 + * @tc.name Document_Choose_002 + * @tc.desc Function of API, choose file.The test file is exist. + */ + it('File_Document_Choose_002', 0, async function (done) { + try { + let uri = ""; + let code = await document.choose(function(err,uri){ + + }); + console.info("getFileUri===>" + code); + expect(uri).assertTrue(); + done(); + } + catch (e) { + console.info('File_Document_Choose_002 has failed for ' + e.message); + expect(e.message == "error").assertTrue(); + done(); + } + }); + + /** + * @tc.number SUB_STORAGE_Document_Choose_0300 + * @tc.name Document_Choose_003 + * @tc.desc Function of API, choose file.The test file is exist. + */ + it('File_Document_Choose_003', 0, async function (done) { + try { + let types = []; + let uri = ""; + let code = await document.choose(types,function(err,uri){ + + }); + console.info("getFileUri===>" + code); + expect().assertTrue(); + done(); + } + catch (e) { + console.info('File_Document_Choose_003 has failed for ' + e.message); + expect(e.message == "error").assertTrue(); + done(); + } + }); + + /** + * @tc.number SUB_STORAGE_Document_Show_0100 + * @tc.name Document_Show_001 + * @tc.desc Function of API, show file.The test file is exist. + */ + it('File_Document_Show_001', 0, async function (done) { + try { + let type = ""; + let uri = ""; + let code = await document.show(uri,type); + console.info("getFileUri===>" + code); + expect().assertTrue(); + done(); + } + catch (e) { + console.info('File_Document_Show_001 has failed for ' + e.message); + expect(e.message == "error").assertTrue(); + done(); + } + }); + + /** + * @tc.number SUB_STORAGE_Document_Show_0200 + * @tc.name Document_Show_002 + * @tc.desc Function of API, show file.The test file is exist. + */ + it('File_Document_Show_002', 0, async function (done) { + try { + let type = ""; + let uri =""; + let code = await document.show(uri,type,function(err){ + + }); + console.info("getFileUri===>" + code); + expect().assertTrue(); + done(); + } + catch (e) { + console.info('File_Document_Show_002 has failed for ' + e.message); + expect(e.message == "error").assertTrue(); + done(); + } + }); }); }