|
@@ -24,12 +24,13 @@ let dirs = null
|
24
|
24
|
describe('Get storage folders', (report, done) => {
|
25
|
25
|
fs.getSystemDirs().then((resp) => {
|
26
|
26
|
dirs = resp
|
|
27
|
+ console.log(dirs)
|
27
|
28
|
report(
|
28
|
29
|
<Assert key="system folders should exists" expect={resp} comparer={Comparer.exists} />,
|
29
|
30
|
<Assert key="check properties"
|
30
|
|
- expect={resp}
|
|
31
|
+ expect={['DocumentDir', 'CacheDir']}
|
31
|
32
|
comparer={Comparer.hasProperties}
|
32
|
|
- actual={['DocumentDir', 'CacheDir', 'DCIMDir', 'DownloadDir']}
|
|
33
|
+ actual={dirs}
|
33
|
34
|
/>,
|
34
|
35
|
<Info key="System Folders">
|
35
|
36
|
<Text>{`${JSON.stringify(dirs)}`}</Text>
|
|
@@ -376,6 +377,36 @@ describe('format conversion', (report, done) => {
|
376
|
377
|
})
|
377
|
378
|
})
|
378
|
379
|
|
|
380
|
+describe('stat and lstat test', (report, done) => {
|
|
381
|
+ let p = ''
|
|
382
|
+ let dirs = null
|
|
383
|
+ let file = null
|
|
384
|
+ fs.getSystemDirs().then((resp) => {
|
|
385
|
+ dirs = resp
|
|
386
|
+ p = dirs.DocumentDir + '/' + 'ls-stat-test' + Date.now()
|
|
387
|
+ return fs.lstat(dirs.DocumentDir)
|
|
388
|
+ })
|
|
389
|
+ // stat a folder
|
|
390
|
+ .then((stat) => {
|
|
391
|
+ report(
|
|
392
|
+ <Assert key="result should be an array"
|
|
393
|
+ expect={true}
|
|
394
|
+ actual={Array.isArray(stat)}/>)
|
|
395
|
+ file = stat[0].path
|
|
396
|
+ return fs.stat(file)
|
|
397
|
+ })
|
|
398
|
+ .then((stat) => {
|
|
399
|
+ console.log(stat)
|
|
400
|
+ report(
|
|
401
|
+ <Assert key="should have properties"
|
|
402
|
+ expect={['size', 'type', 'lastModified', 'filename', 'path']}
|
|
403
|
+ comparer={Comparer.hasProperties}
|
|
404
|
+ actual={stat}/>)
|
|
405
|
+ done()
|
|
406
|
+ })
|
|
407
|
+
|
|
408
|
+})
|
|
409
|
+
|
379
|
410
|
function getASCIIArray(str) {
|
380
|
411
|
let r = []
|
381
|
412
|
for(let i=0;i<str.length;i++) {
|