Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
dc940686
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
5995
Star
90
Fork
162
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
18
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello uni-app x
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
18
Issue
18
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
dc940686
编写于
4月 12, 2024
作者:
W
WOSHIMAHAIFENG
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
添加file 测试用例
上级
3c9460b5
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
96 addition
and
9 deletion
+96
-9
pages/API/get-file-system-manager/get-file-system-manager.test.js
...I/get-file-system-manager/get-file-system-manager.test.js
+96
-9
未找到文件。
pages/API/get-file-system-manager/get-file-system-manager.test.js
浏览文件 @
dc940686
...
@@ -1143,7 +1143,6 @@ describe('ExtApi-FileManagerTest', () => {
...
@@ -1143,7 +1143,6 @@ describe('ExtApi-FileManagerTest', () => {
})
})
await
createFile
()
await
createFile
()
await
page
.
setData
({
await
page
.
setData
({
basePath
:
basePath
,
basePath
:
basePath
,
temFile
:
'
save/1.txt
'
,
temFile
:
'
save/1.txt
'
,
...
@@ -1156,9 +1155,18 @@ describe('ExtApi-FileManagerTest', () => {
...
@@ -1156,9 +1155,18 @@ describe('ExtApi-FileManagerTest', () => {
await
page
.
setData
({
await
page
.
setData
({
saveFileRet
:
''
saveFileRet
:
''
})
})
await
clearDir
(
''
)
});
it
(
'
saveFileSyncTest
'
,
async
()
=>
{
let
globalTempPath
=
await
getData
(
'
globalTempPath
'
)
let
basePath
=
await
getData
(
'
basePath
'
)
await
page
.
setData
({
basePath
:
basePath
})
await
clearDir
(
''
)
await
page
.
setData
({
await
page
.
setData
({
basePath
:
globalTempPath
,
basePath
:
globalTempPath
,
temFile
:
'
save/2.txt
'
,
temFile
:
'
save/2.txt
'
,
...
@@ -1189,15 +1197,81 @@ describe('ExtApi-FileManagerTest', () => {
...
@@ -1189,15 +1197,81 @@ describe('ExtApi-FileManagerTest', () => {
await
btnSavedFileList
.
tap
()
await
btnSavedFileList
.
tap
()
await
isDone
()
await
isDone
()
let
fileListSuccess
=
await
getData
(
"
fileListSuccess
"
)
let
fileListSuccess
=
await
getData
(
"
fileListSuccess
"
)
expect
(
fileListSuccess
.
length
).
toEqual
(
3
)
expect
(
fileListSuccess
.
length
>
0
).
toEqual
(
true
)
await
clearDir
(
''
)
});
it
(
'
getSavedFileListTest
'
,
async
()
=>
{
let
globalTempPath
=
await
getData
(
'
globalTempPath
'
)
let
basePath
=
await
getData
(
'
basePath
'
)
await
page
.
setData
({
basePath
:
basePath
})
await
clearDir
(
''
)
await
page
.
setData
({
basePath
:
globalTempPath
,
temFile
:
'
save/2.txt
'
,
mkdirFile
:
'
save
'
,
writeFile
:
'
save/2.txt
'
,
accessFile
:
'
2.txt
'
})
await
createFile
()
await
page
.
setData
({
basePath
:
basePath
,
writeFile
:
'
save/2.txt
'
,
})
btnSaveFile
=
await
page
.
$
(
'
#btn-save-file-sync
'
)
await
btnSaveFile
.
tap
()
await
isDone
()
let
btnSavedFileList
=
await
page
.
$
(
'
#btn-getsaved-filelist
'
)
await
btnSavedFileList
.
tap
()
await
isDone
()
let
fileListSuccess
=
await
getData
(
"
fileListSuccess
"
)
expect
(
fileListSuccess
.
length
>
0
).
toEqual
(
true
)
await
clearDir
(
''
)
});
it
(
'
removeSavedFileTest
'
,
async
()
=>
{
let
globalTempPath
=
await
getData
(
'
globalTempPath
'
)
let
basePath
=
await
getData
(
'
basePath
'
)
await
page
.
setData
({
basePath
:
basePath
})
await
clearDir
(
''
)
await
page
.
setData
({
basePath
:
globalTempPath
,
temFile
:
'
save/2.txt
'
,
mkdirFile
:
'
save
'
,
writeFile
:
'
save/2.txt
'
,
accessFile
:
'
2.txt
'
})
await
createFile
()
await
page
.
setData
({
basePath
:
basePath
,
writeFile
:
'
save/2.txt
'
,
})
btnSaveFile
=
await
page
.
$
(
'
#btn-save-file-sync
'
)
await
btnSaveFile
.
tap
()
await
isDone
()
let
btnRemoveSavedFileRet
=
await
page
.
$
(
'
#btn-remove-saved-file
'
)
await
btnRemoveSavedFileRet
.
tap
()
let
removeSavedFileRet
=
await
getData
(
"
removeSavedFileRet
"
)
expect
(
removeSavedFileRet
).
toEqual
(
'
removeSavedFile:ok
'
)
await
clearDir
(
''
)
await
clearDir
(
''
)
});
});
//openFiletest openFileSynctest closeTest closeTestSync writeTest writeSyncTest
//openFiletest openFileSynctest closeTest closeTestSync writeTest writeSyncTest
it
(
'
fd
test
'
,
async
()
=>
{
it
(
'
openFile
test
'
,
async
()
=>
{
await
clearDir
(
''
)
await
clearDir
(
''
)
await
page
.
setData
({
await
page
.
setData
({
mkdirFile
:
'
fd
'
,
mkdirFile
:
'
fd
'
,
...
@@ -1221,8 +1295,16 @@ describe('ExtApi-FileManagerTest', () => {
...
@@ -1221,8 +1295,16 @@ describe('ExtApi-FileManagerTest', () => {
await
isDone
()
await
isDone
()
fd
=
await
getData
(
"
fd
"
)
fd
=
await
getData
(
"
fd
"
)
expect
(
fd
).
not
.
toBe
(
''
);
expect
(
fd
).
not
.
toBe
(
''
);
});
// closeTest closeTestSync
it
(
'
closeTest
'
,
async
()
=>
{
await
clearDir
(
''
)
await
page
.
setData
({
mkdirFile
:
'
fd
'
,
writeFile
:
'
fd/1.txt
'
,
readFile
:
'
fd/1.txt
'
})
await
createFile
()
//closeTest
//closeTest
let
btnCloseFile
=
await
page
.
$
(
'
#btn-close-file
'
)
let
btnCloseFile
=
await
page
.
$
(
'
#btn-close-file
'
)
await
btnCloseFile
.
tap
()
await
btnCloseFile
.
tap
()
...
@@ -1239,12 +1321,17 @@ describe('ExtApi-FileManagerTest', () => {
...
@@ -1239,12 +1321,17 @@ describe('ExtApi-FileManagerTest', () => {
closeFileRet
=
await
getData
(
"
closeFileRet
"
)
closeFileRet
=
await
getData
(
"
closeFileRet
"
)
expect
(
closeFileRet
).
toEqual
(
'
close:ok
'
)
expect
(
closeFileRet
).
toEqual
(
'
close:ok
'
)
//writeTest
});
//writeTest writeSyncTest
it
(
'
writeTest
'
,
async
()
=>
{
await
clearDir
(
''
)
await
page
.
setData
({
await
page
.
setData
({
mkdirFile
:
'
fd
'
,
writeFile
:
'
fd/1.txt
'
,
writeFile
:
'
fd/1.txt
'
,
readFile
:
'
fd/1.txt
'
,
readFile
:
'
fd/1.txt
'
,
writeData
:
'
我是一只小小鸟
'
writeData
:
'
我是一只小小鸟
'
})
})
await
createFile
()
let
btnWrite
=
await
page
.
$
(
'
#btn-write
'
)
let
btnWrite
=
await
page
.
$
(
'
#btn-write
'
)
await
btnWrite
.
tap
()
await
btnWrite
.
tap
()
...
@@ -1259,10 +1346,10 @@ describe('ExtApi-FileManagerTest', () => {
...
@@ -1259,10 +1346,10 @@ describe('ExtApi-FileManagerTest', () => {
writeData
:
'
我是
'
writeData
:
'
我是
'
})
})
btnWrite
=
await
page
.
$
(
'
#btn-write
'
)
btnWrite
=
await
page
.
$
(
'
#btn-write
'
)
await
btnWrite
.
tap
()
await
btnWrite
.
tap
()
await
isDone
()
await
isDone
()
bytesWritten
=
await
getData
(
"
bytesWritten
"
)
bytesWritten
=
await
getData
(
"
bytesWritten
"
)
expect
(
bytesWritten
).
toEqual
(
2
)
expect
(
bytesWritten
).
toEqual
(
2
)
//fstatTest
//fstatTest
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录