Files
puter/tests/api-tester/tests/readdir.js
T
Xiaochen CuiandGitHub c93a53ead2 ci: init e2e test for browser env, tidy other tests (#1796)
* ci: init e2e test for browser env

stash changes

* test: update fsentry definition, add tests

stash changes

* test: pass puter-js mkdir test

* test: add test for puter-js move

* tidy code

* tidy code

* doc: add docs for playwright test

* recover memoryfs

* test: puter-js readdir/stat

* test: puter-js write

* test: puter-js read

* test: puter-js move_cart

* test: fix failed tests on move

* tests: rename files

* test: puter-js copy_cart

* tests: puter-js batch/delete, read config from file

* ci: add vitest

* ci: update names and timeout

* ci: simplify playwright-test

* ci: simplify api-test

* move "api-tester" from tools to tests

* test: update example config

* test: remove folder tests/api-tester/ci

* test: unify config location

* test: remove unused files

* ci: fix wrong config

* ci: fix wrong path

* test: add docs

* ci: update timeout, print artifact url
2025-10-28 16:35:37 -07:00

40 lines
1.1 KiB
JavaScript

const { verify_fsentry } = require("./fsentry");
const { expect } = require("chai");
module.exports = {
name: 'readdir',
do: async t => {
// let result;
await t.mkdir('test_readdir', { overwrite: true });
t.cd('test_readdir');
const files = ['a.txt', 'b.txt', 'c.txt'];
const dirs = ['q', 'w', 'e'];
for ( const file of files ) {
await t.write(file, 'readdir test\n', { overwrite: true });
}
for ( const dir of dirs ) {
await t.mkdir(dir, { overwrite: true });
}
for ( const file of files ) {
const result = await t.stat(file);
await verify_fsentry(t, result);
}
for ( const dir of dirs ) {
const result = await t.stat(dir);
await verify_fsentry(t, result);
}
await t.case('readdir of root shouldn\'t return everything', async () => {
const result = await t.readdir('/', { recursive: true });
console.log('result?', result)
})
// t.cd('..');
}
};