Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
01099ee0
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
01099ee0
编写于
5月 31, 2022
作者:
O
openharmony_ci
提交者:
Gitee
5月 31, 2022
浏览文件
操作
浏览文件
下载
差异文件
!3380 update storagestatfsjstest
Merge pull request !3380 from raoxian/master
上级
f0e73a66
371686f2
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
169 addition
and
166 deletion
+169
-166
storage/storagestatfsjstest/src/main/js/default/test/statfs.test.js
...oragestatfsjstest/src/main/js/default/test/statfs.test.js
+169
-166
未找到文件。
storage/storagestatfsjstest/src/main/js/default/test/statfs.test.js
浏览文件 @
01099ee0
...
@@ -13,209 +13,212 @@
...
@@ -13,209 +13,212 @@
* limitations under the License.
* limitations under the License.
*/
*/
import
{
import
{
describe
,
it
,
expect
,
isIntNum
,
statfs
}
from
'
./Common
'
;
describe
,
it
,
expect
,
isIntNum
,
statfs
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
}
from
'
./Common
'
;
describe
(
'
statfs
'
,
function
()
{
describe
(
'
statfs
'
,
function
()
{
/**
/**
* @tc.number SUB_DF_Statfs_getFreeBytes_0000
* @tc.number SUB_DF_STATFS_GET_FREE_BYTES_0000
* @tc.name statfs_test_get_free_bytes_async_000
* @tc.name statfs_test_get_free_bytes_async_000
* @tc.desc Test getFreeBytes() interfaces.
* @tc.desc Test getFreeBytes() interfaces, When the path is a sandbox path, promise way back.
*/
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
statfs_test_get_free_bytes_async_000
'
,
0
,
async
function
(
done
)
{
it
(
'
statfs_test_get_free_bytes_async_000
'
,
0
,
async
function
(
done
)
{
try
{
try
{
statfs
.
getFreeBytes
(
'
/
'
,
function
(
err
,
number
)
{
let
context
=
featureAbility
.
getContext
();
expect
(
isIntNum
(
number
)).
assertTrue
();
let
data
=
await
context
.
getFilesDir
();
done
();
let
number
=
await
statfs
.
getFreeBytes
(
data
);
})
console
.
info
(
"
getFreeBytes getFilesDir===>
"
+
(
number
/
1024
));
expect
(
isIntNum
(
number
)).
assertTrue
();
done
();
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'
statfs_test_get_free_bytes_async_000 has failed for
'
+
e
);
console
.
info
(
'
statfs_test_get_free_bytes_async_000 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
expect
(
null
).
assertFail
();
}
}
});
});
/**
/**
* @tc.number SUB_DF_Statfs_getFreeBytes_0010
* @tc.number SUB_DF_STATFS_GET_FREE_BYTES_0010
* @tc.name statfs_test_get_free_bytes_async_001
* @tc.name statfs_test_get_free_bytes_async_001
* @tc.desc Test getFreeBytes() interfaces.
* @tc.desc Test getFreeBytes() interfaces, When the path is dev, callback way back.
*/
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
statfs_test_get_free_bytes_async_001
'
,
0
,
async
function
(
done
)
{
it
(
'
statfs_test_get_free_bytes_async_001
'
,
0
,
async
function
(
done
)
{
try
{
try
{
let
number
=
await
statfs
.
getFreeBytes
(
"
/data
"
);
statfs
.
getFreeBytes
(
"
/dev
"
,(
err
,
number
)
=>
{
expect
(
isIntNum
(
number
)).
assertTrue
();
console
.
info
(
"
getFreeBytesNumber dev===>:
"
+
(
number
/
1024
));
done
();
expect
(
isIntNum
(
number
)).
assertTrue
();
done
();
});
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'
statfs_test_get_free_bytes_async_001 has failed for
'
+
e
);
console
.
info
(
'
statfs_test_get_free_bytes_async_001 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
expect
(
null
).
assertFail
();
}
}
});
});
/**
/**
* @tc.number SUB_DF_Statfs_getFreeBytes_0020
* @tc.number SUB_DF_STATFS_GET_FREE_BYTES_0020
* @tc.name statfs_test_get_free_bytes_async_002
* @tc.name statfs_test_get_free_bytes_async_002
* @tc.desc Test getFreeBytes() interfaces.
* @tc.desc Test getFreeBytes() interfaces, When the parameter type is wrong.
*/
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
statfs_test_get_free_bytes_async_002
'
,
0
,
async
function
(
done
)
{
it
(
'
statfs_test_get_free_bytes_async_002
'
,
0
,
async
function
(
done
)
{
try
{
try
{
let
number
=
await
statfs
.
getFreeBytes
(
"
/dev
"
);
await
statfs
.
getFreeBytes
(
1
);
expect
(
isIntNum
(
number
)).
assertTrue
();
}
catch
(
err
)
{
console
.
info
(
'
statfs_test_get_free_bytes_async_002 has failed for
'
+
err
);
expect
(
err
.
message
==
"
Invalid path
"
).
assertTrue
();
done
();
done
();
}
catch
(
e
)
{
console
.
log
(
'
statfs_test_get_free_bytes_async_002 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
}
}
});
});
/**
/**
* @tc.number SUB_DF_Statfs_getFreeBytes_0030
* @tc.number SUB_DF_STATFS_GET_FREE_BYTES_0030
* @tc.name statfs_test_get_free_bytes_async_003
* @tc.name statfs_test_get_free_bytes_async_003
* @tc.desc Test getFreeBytes() interfaces.
* @tc.desc Test getFreeBytes() interfaces, When there are no parameters.
*/
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
statfs_test_get_free_bytes_async_003
'
,
0
,
async
function
(
done
)
{
it
(
'
statfs_test_get_free_bytes_async_003
'
,
0
,
async
function
(
done
)
{
try
{
try
{
await
statfs
.
getFreeBytes
(
"
/
"
,
''
);
await
statfs
.
getFreeBytes
();
expect
(
null
).
assertFail
();
}
catch
(
err
)
{
done
();
console
.
info
(
'
statfs_test_get_free_bytes_async_003 has failed for
'
+
err
);
}
catch
(
e
)
{
expect
(
err
.
message
==
"
Number of arguments unmatched
"
).
assertTrue
();
console
.
log
(
'
statfs_test_get_free_bytes_async_003 has failed for
'
+
e
);
expect
(
!!
e
).
assertTrue
();
done
();
done
();
}
}
});
});
/**
/**
* @tc.number SUB_DF_Statfs_getFreeBytes_0040
* @tc.number SUB_DF_STATFS_GET_FREE_BYTES_0040
* @tc.name statfs_test_get_free_bytes_async_004
* @tc.name statfs_test_get_free_bytes_async_004
* @tc.desc Test getFreeBytes() interfaces.
* @tc.desc Test getFreeBytes() interfaces, When the path is empty.
*/
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
statfs_test_get_free_bytes_async_004
'
,
0
,
async
function
(
done
)
{
it
(
'
statfs_test_get_free_bytes_async_004
'
,
0
,
async
function
(
done
)
{
try
{
statfs
.
getFreeBytes
(
function
(
err
,
number
)
{
done
();
})
}
catch
(
e
)
{
console
.
log
(
'
statfs_test_get_free_bytes_async_004 has failed for
'
+
e
);
expect
(
!!
e
).
assertTrue
();
done
();
}
});
/**
* @tc.number SUB_DF_Statfs_getFreeBytes_0050
* @tc.name statfs_test_get_free_bytes_async_005
* @tc.desc Test getFreeBytes() interfaces.
*/
it
(
'
statfs_test_get_free_bytes_async_005
'
,
0
,
async
function
(
done
)
{
try
{
try
{
await
statfs
.
getFreeBytes
(
""
);
await
statfs
.
getFreeBytes
(
""
);
expect
(
null
).
assertFail
();
}
catch
(
err
)
{
done
();
console
.
info
(
'
statfs_test_get_free_bytes_async_004 has failed for
'
+
err
);
}
catch
(
e
)
{
expect
(
err
.
message
==
"
No such file or directory
"
).
assertTrue
();
console
.
log
(
'
statfs_test_get_free_bytes_async_005 has failed for
'
+
e
);
expect
(
!!
e
).
assertTrue
();
done
();
done
();
}
}
});
});
/**
/**
* @tc.number SUB_DF_Statfs_getTotalBytes_0000
* @tc.number SUB_DF_STATFS_GET_TOTAL_BYTES_0000
* @tc.name statfs_test_get_total_bytes_async_000
* @tc.name statfs_test_get_total_bytes_async_000
* @tc.desc Test getTotalBytes() interfaces.
* @tc.desc Test getTotalBytes() interfaces, When the path is a sandbox path, promise way back.
*/
* @tc.size MEDIUM
it
(
'
statfs_test_get_total_bytes_async_000
'
,
0
,
async
function
(
done
)
{
* @tc.type Function
try
{
* @tc.level Level 0
statfs
.
getTotalBytes
(
'
/
'
,
function
(
err
,
number
)
{
* @tc.require
*/
it
(
'
statfs_test_get_total_bytes_async_000
'
,
0
,
async
function
(
done
)
{
try
{
let
context
=
featureAbility
.
getContext
();
let
data
=
await
context
.
getFilesDir
();
let
number
=
await
statfs
.
getTotalBytes
(
data
);
console
.
info
(
"
getTotalBytesNumber GetFilesDir====>:
"
+
(
number
/
1024
));
expect
(
isIntNum
(
number
)).
assertTrue
();
expect
(
isIntNum
(
number
)).
assertTrue
();
done
();
done
();
})
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
info
(
'
statfs_test_get_total_bytes_async_000 has failed for
'
+
e
);
console
.
log
(
'
statfs_test_get_total_bytes_async_000 has failed for
'
+
e
);
expect
(
null
).
assertFail
();
expect
(
null
).
assertFail
();
}
}
});
});
/**
/**
* @tc.number SUB_DF_STATFS_GET_TOTAL_BYTES_0010
* @tc.number SUB_DF_Statfs_getTotalBytes_0010
* @tc.name statfs_test_get_total_bytes_async_001
* @tc.name statfs_test_get_total_bytes_async_001
* @tc.desc Test getTotalBytes() interfaces, When the path is dev, callback way back.
* @tc.desc Test getTotalBytes() interfaces.
* @tc.size MEDIUM
*/
* @tc.type Function
it
(
'
statfs_test_get_total_bytes_async_001
'
,
0
,
async
function
(
done
)
{
* @tc.level Level 0
try
{
* @tc.require
let
number
=
await
statfs
.
getTotalBytes
(
"
/data
"
);
*/
expect
(
isIntNum
(
number
)).
assertTrue
();
it
(
'
statfs_test_get_total_bytes_async_001
'
,
0
,
async
function
(
done
)
{
done
();
try
{
}
catch
(
e
)
{
statfs
.
getTotalBytes
(
"
/dev
"
,(
err
,
number
)
=>
{
console
.
log
(
'
statfs_test_get_total_bytes_async_001 has failed for
'
+
e
);
console
.
info
(
"
getTotalBytesNumber dev===>:
"
+
(
number
/
1024
));
expect
(
null
).
assertFail
();
expect
(
isIntNum
(
number
)).
assertTrue
();
}
done
();
});
});
}
catch
(
e
)
{
/**
console
.
info
(
'
statfs_test_get_total_bytes_async_001 has failed for
'
+
e
);
* @tc.number SUB_DF_Statfs_getTotalBytes_0020
expect
(
null
).
assertFail
();
* @tc.name statfs_test_get_total_bytes_async_002
}
* @tc.desc Test getTotalBytes() interfaces.
});
*/
it
(
'
statfs_test_get_total_bytes_async_002
'
,
0
,
async
function
(
done
)
{
/**
try
{
* @tc.number SUB_DF_STATFS_GET_TOTAL_BYTES_0020
let
number
=
await
statfs
.
getTotalBytes
(
"
/dev
"
);
* @tc.name statfs_test_get_total_bytes_async_002
expect
(
isIntNum
(
number
)).
assertTrue
();
* @tc.desc Test getTotalBytes() interfaces, When the parameter type is wrong.
done
();
* @tc.size MEDIUM
}
catch
(
e
)
{
* @tc.type Function
console
.
log
(
'
statfs_test_get_total_bytes_async_002 has failed for
'
+
e
);
* @tc.level Level 0
expect
(
null
).
assertFail
();
* @tc.require
}
*/
});
it
(
'
statfs_test_get_total_bytes_async_002
'
,
0
,
async
function
(
done
)
{
try
{
/**
await
statfs
.
getTotalBytes
(
1
);
* @tc.number SUB_DF_Statfs_getTotalBytes_0030
}
catch
(
err
)
{
* @tc.name statfs_test_get_total_bytes_async_003
console
.
info
(
'
statfs_test_get_total_bytes_async_002 has failed for
'
+
err
);
* @tc.desc Test getTotalBytes() interfaces.
expect
(
err
.
message
==
"
Invalid path
"
).
assertTrue
();
*/
it
(
'
statfs_test_get_total_bytes_async_003
'
,
0
,
async
function
(
done
)
{
try
{
await
statfs
.
getTotalBytes
(
"
/
"
,
''
);
expect
(
null
).
assertFail
();
done
();
}
catch
(
e
)
{
console
.
log
(
'
statfs_test_get_total_bytes_async_003 has failed for
'
+
e
);
expect
(
!!
e
).
assertTrue
();
done
();
}
});
/**
* @tc.number SUB_DF_Statfs_getTotalBytes_0040
* @tc.name statfs_test_get_total_bytes_async_004
* @tc.desc Test getTotalBytes() interfaces.
*/
it
(
'
statfs_test_get_total_bytes_async_004
'
,
0
,
async
function
(
done
)
{
try
{
statfs
.
getTotalBytes
(
function
(
err
,
number
)
{
done
();
done
();
})
}
}
catch
(
e
)
{
});
console
.
log
(
'
statfs_test_get_total_bytes_async_004 has failed for
'
+
e
);
expect
(
!!
e
).
assertTrue
();
/**
done
();
* @tc.number SUB_DF_STATFS_GET_TOTAL_BYTES_0030
}
* @tc.name statfs_test_get_total_bytes_async_003
});
* @tc.desc Test getTotalBytes() interfaces, When there are no parameters.
* @tc.size MEDIUM
/**
* @tc.type Function
* @tc.number SUB_DF_Statfs_getTotalBytes_0050
* @tc.level Level 0
* @tc.name statfs_test_get_total_bytes_async_005
* @tc.require
* @tc.desc Test getTotalBytes() interfaces.
*/
*/
it
(
'
statfs_test_get_total_bytes_async_003
'
,
0
,
async
function
(
done
)
{
it
(
'
statfs_test_get_total_bytes_async_005
'
,
0
,
async
function
(
done
)
{
try
{
try
{
await
statfs
.
getTotalBytes
();
await
statfs
.
getFreeBytes
(
""
);
}
catch
(
err
)
{
expect
(
null
).
assertFail
();
console
.
info
(
'
statfs_test_get_total_bytes_async_003 has failed for
'
+
err
);
done
();
expect
(
err
.
message
==
"
Number of arguments unmatched
"
).
assertTrue
();
}
catch
(
e
)
{
done
();
console
.
log
(
'
statfs_test_get_total_bytes_async_005 has failed for
'
+
e
);
}
expect
(
!!
e
).
assertTrue
();
});
done
();
}
/**
});
* @tc.number SUB_DF_STATFS_GET_TOTAL_BYTES_0040
* @tc.name statfs_test_get_total_bytes_async_004
* @tc.desc Test getTotalBytes() interfaces, When the path is empty.
* @tc.size MEDIUM
* @tc.type Function
* @tc.level Level 0
* @tc.require
*/
it
(
'
statfs_test_get_total_bytes_async_004
'
,
0
,
async
function
(
done
)
{
try
{
await
statfs
.
getTotalBytes
(
""
);
}
catch
(
err
)
{
console
.
info
(
'
statfs_test_get_total_bytes_async_004 has failed for
'
+
err
);
expect
(
err
.
message
==
"
No such file or directory
"
).
assertTrue
();
done
();
}
});
});
});
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录