Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/hooks/usePantry.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,17 @@ Deno.test("runtime.env", async () => {
assertEquals(env.BAZ, prefix.join("bar.com/v1.2.3/baz").string)
})

Deno.test("missing()", () => {
Deno.test("missing - without cache", () => {
useTestConfig()
usePantry().prefix.rm({ recursive: true })
assert(usePantry().missing())
})

Deno.test("missing - with cache", () => {
useTestConfig().cache.mkdir("p").join('pantry.db').touch()
usePantry().prefix.rm({ recursive: true })
assert(usePantry().missing())
})

Deno.test("validatePackageRequirement - valid input", () => {
const result = validatePackageRequirement("pkgx.sh/test", "^1.0.0")
Expand Down
8 changes: 1 addition & 7 deletions src/hooks/usePantry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,17 +275,11 @@ export default function usePantry() {
function pantry_paths(): Path[] {
const rv: Path[] = []

if (prefix.isDirectory()) {
rv.push(prefix)
}
rv.push(prefix)
for (const path of useConfig().pantries.reverse()) {
rv.unshift(path.join("projects"))
}

if (rv.length == 0) {
throw new PantryNotFoundError(prefix)
}

return rv
}
}
Expand Down
Loading