Skip to content

Commit

Permalink
test: make sure paths never start with ./
Browse files Browse the repository at this point in the history
  • Loading branch information
thecodrr committed Jul 31, 2023
1 parent 4f4639c commit 472bbf1
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions __tests__/fdir.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,22 @@ test(`[async] crawl directory & use abort signal to abort`, async (t) => {
t.expect(files.length).toBeLessThan(totalFiles.files);
});

test(`paths should never start with ./`, async (t) => {
const apis = [
new fdir().withBasePath().crawl("./node_modules"),
new fdir().withBasePath().crawl("./"),
new fdir().withRelativePaths().crawl("./"),
new fdir().withDirs().crawl("."),
new fdir().onlyDirs().crawl("."),
];
for (const api of apis) {
const files = await api.withPromise();
t.expect(
files.every((file) => !file.startsWith("./") && !file.startsWith(".\\"))
).toBe(true);
}
});

test(`ignore withRelativePath if root === ./`, async (t) => {
const relativeFiles = await new fdir()
.withRelativePaths()
Expand Down

0 comments on commit 472bbf1

Please sign in to comment.