diff --git a/pages/API/get-file-system-manager/get-file-system-manager.js b/pages/API/get-file-system-manager/get-file-system-manager.test.js
similarity index 89%
rename from pages/API/get-file-system-manager/get-file-system-manager.js
rename to pages/API/get-file-system-manager/get-file-system-manager.test.js
index 814eff2e1e26194d12d9304acb032f2b217ef7a0..956e34b6001b40067954d56e48ab1fe1ab083cad 100644
--- a/pages/API/get-file-system-manager/get-file-system-manager.js
+++ b/pages/API/get-file-system-manager/get-file-system-manager.test.js
@@ -1,4 +1,4 @@
-const PAGE_PATH = '/pages/API/filemanager/filemanager'
+const PAGE_PATH = '/pages/API/get-file-system-manager/get-file-system-manager'
describe('ExtApi-FileManagerTest', () => {
@@ -700,4 +700,98 @@ describe('ExtApi-FileManagerTest', () => {
});
+// it('stat and asset test', async () => {
+// // 测试 USER_DATA_PATH
+// let globalInnerRootPath = await getData('globalInnerRootPath')
+
+// await page.setData({
+// recursiveVal: true,
+// copyToBasePath:globalInnerRootPath,
+// basePath: globalInnerRootPath,
+// rmDirFile:'a',
+// mkdirFile:'a',
+// unlinkFile:'a/1.txt',
+// })
+
+// // 先清除文件,需要清除全部可能存在的历史测试文件,避免运行失败
+// const btnUnLinkFileButton = await page.$('.btn-unlink-file')
+// await btnUnLinkFileButton.tap()
+// await isDone()
+
+// await page.setData({
+// unlinkFile:'a/2.txt',
+// })
+// await btnUnLinkFileButton.tap()
+// await isDone()
+
+// await page.setData({
+// unlinkFile:'a/m/3.txt',
+// })
+// await btnUnLinkFileButton.tap()
+// await isDone()
+
+// // // 清除文件夹
+// const btnRmDirButton = await page.$('.btn-remove-dir')
+// await btnRmDirButton.tap()
+// await isDone()
+// // // 重新创建测试目录
+// const btnMkdDirButton = await page.$('.btn-mkdir')
+// await btnMkdDirButton.tap()
+// await isDone()
+
+// const btnReadDirButton = await page.$('.btn-read-dir')
+// await btnReadDirButton.tap()
+// await isDone()
+
+
+// // 期望通过 recursive = true的 文件夹删除,得到一个空的 /a 目录
+// let fileListComplete = await getData('fileListComplete')
+// expect(JSON.stringify(fileListComplete)).toEqual('[]')
+// let fileListSuccess = await getData('fileListSuccess')
+// expect(JSON.stringify(fileListSuccess)).toEqual('[]')
+
+// // 写入一个文件
+// await page.setData({
+// writeFileContent: "锄禾日当午,汗滴禾下土,谁知盘中餐,粒粒皆辛苦",
+// writeFileEncoding:"utf-8",
+// writeFile:'a/1.txt',
+// recursiveVal:false,
+// statFile:'a/1.txt',
+// })
+
+
+
+// let lastFailError = await getData('lastFailError')
+// console.log(lastFailError)
+
+// // const btnWriteFileButton = await page.$('.btn-write-file')
+// // await btnWriteFileButton.tap()
+// // await isDone()
+
+// // const btnStatFileButton = await page.$('.btn-stat-file')
+// // await btnStatFileButton.tap()
+// // await isDone()
+
+// // // 读取单个文件信息
+// // let statsRet = await getData('statsRet')
+// // console.log(statsRet)
+// // expect(statsRet.path).toEqual('')
+
+// // await page.setData({
+// // recursiveVal:true,
+// // statFile:'a/1.txt',
+// // })
+
+// // await btnStatFileButton.tap()
+// // await isDone()
+
+// // // 读取单个文件信息
+// // statsRet = await getData('statsRet')
+// // console.log(statsRet)
+// // expect(statsRet.path).toEqual('')
+
+
+
+// });
+
});
diff --git a/pages/API/get-file-system-manager/get-file-system-manager.uvue b/pages/API/get-file-system-manager/get-file-system-manager.uvue
index 625093b03cd413ac66b8f69fe5dabd39083745f6..d4d7833509dabca277198cebb13f1b2aae24bd3e 100644
--- a/pages/API/get-file-system-manager/get-file-system-manager.uvue
+++ b/pages/API/get-file-system-manager/get-file-system-manager.uvue
@@ -11,6 +11,7 @@
+
@@ -40,6 +41,7 @@
renameFromFile:'a/2.txt',
renameToFile:'a/3.txt',
getFileInfoFile:'a/1.txt',
+ statFile:'a/1.txt',
rmDirFile:'a',
mkdirFile:'a',
readFile:'a/1.txt',
@@ -47,6 +49,7 @@
done: false,
writeFileEncoding:"utf-8",
readFileEncoding:"utf-8",
+ statsRet:[] as Array,
/**
* 待测试的全局环境变量
*/
@@ -65,6 +68,30 @@
methods: {
+ statFileInfoTest:function(e:any){
+ let fileManager = uni.getFileSystemManager()
+
+ fileManager.stat({
+ path:`${this.basePath}${this.statFile}`,
+ recursive:this.recursiveVal,
+ success:function(res:StatSuccessResult){
+ console.log('success',res)
+ this.statsRet = res.stats
+ console.log('this.statsRet',this.statsRet)
+ },
+ fail:function(res:any){
+ console.log('fail',res)
+ this.lastFailError = res
+ },
+ complete:function(res:any){
+ console.log("complete",res)
+ this.done = true
+ if(res instanceof UniError){
+ this.lastCompleteError = res
+ }
+ }
+ } as StatOptions)
+ },
getFileInfoTest:function(e:any){
let fileManager = uni.getFileSystemManager()