提交 0e27a6f9 编写于 作者: L li-ni1995

[storage standard] [master] add five test cases of document api

Signed-off-by: Nli-ni1995 <lini19@huawei.com>
Change-Id: Ia0fadfd50a26454069cc5b349fcd1881edc505a3
上级 0fe318a3
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
import fileio from '@ohos.fileio'; import fileio from '@ohos.fileio';
import file from '@system.file'; import file from '@system.file';
import document from '@ohos.document';
import { import {
describe, describe,
it, it,
...@@ -3823,5 +3824,114 @@ describe('fileTest', function () { ...@@ -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();
}
});
}); });
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册