readdir.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. const { verify_fsentry } = require("./fsentry");
  2. const { expect } = require("chai");
  3. module.exports = {
  4. name: 'readdir',
  5. do: async t => {
  6. // let result;
  7. await t.mkdir('test_readdir', { overwrite: true });
  8. t.cd('test_readdir');
  9. const files = ['a.txt', 'b.txt', 'c.txt'];
  10. const dirs = ['q', 'w', 'e'];
  11. for ( const file of files ) {
  12. await t.write(file, 'readdir test\n', { overwrite: true });
  13. }
  14. for ( const dir of dirs ) {
  15. await t.mkdir(dir, { overwrite: true });
  16. }
  17. for ( const file of files ) {
  18. const result = await t.stat(file);
  19. await verify_fsentry(t, result);
  20. }
  21. for ( const dir of dirs ) {
  22. const result = await t.stat(dir);
  23. await verify_fsentry(t, result);
  24. }
  25. await t.case('readdir of root shouldn\'t return everything', async () => {
  26. const result = await t.readdir('/', { recursive: true });
  27. console.log('result?', result)
  28. })
  29. // t.cd('..');
  30. }
  31. };