Skip to content

Commit

Permalink
test: update
Browse files Browse the repository at this point in the history
  • Loading branch information
thecodrr committed Jul 31, 2023
1 parent 4336056 commit d09c43a
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions __tests__/fdir.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ for (const type of apiTypes) {
test(`[${type}] crawl and get files that match a glob pattern`, async (t) => {
const api = new fdir()
.withBasePath()
.glob("./**/*.js")
.glob("./**/*.js")
.glob("**/*.js")
.glob("**/*.js")
.crawl("node_modules");
const files = await api[type]();
t.expect(files.every((file) => file.endsWith(".js"))).toBeTruthy();
Expand Down Expand Up @@ -175,9 +175,13 @@ for (const type of apiTypes) {
});

test(`[${type}] crawl all files in a directory (with base path)`, async (t) => {
const api = new fdir().withBasePath().crawl(cwd());
const api = new fdir()
.withBasePath()
.crawl(path.join(cwd(), "node_modules"));
const files = await api[type]();
t.expect(files.every((file) => file.includes(cwd()))).toBeTruthy();
t.expect(
files.every((file) => file.startsWith("node_modules"))
).toBeTruthy();
});

test(`[${type}] get all files in a directory and output full paths (withFullPaths)`, async (t) => {
Expand Down

0 comments on commit d09c43a

Please sign in to comment.