-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathuseCache.test.ts
More file actions
32 lines (28 loc) · 1.02 KB
/
useCache.test.ts
File metadata and controls
32 lines (28 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { Stowage, StowageNativeBottle } from "../types.ts"
import { useTestConfig } from "./useTestConfig.ts"
import { assertEquals } from "deno/assert/mod.ts"
import SemVer from "../utils/semver.ts"
import useCache from "./useCache.ts"
import host from "../utils/host.ts"
Deno.test("useCache", () => {
const { cache } = useTestConfig()
const hw = (({ platform, arch }) => `${platform}+${arch}`)(host())
const stowage = StowageNativeBottle({
pkg: { project: "foo/bar", version: new SemVer("1.0.0") },
compression: "xz"
});
assertEquals(useCache().path(stowage), cache.join(`foo∕bar-1.0.0+${hw}.tar.xz`))
const stowage2: Stowage = {
type: 'bottle',
pkg: stowage.pkg,
host: { platform: "linux", arch: "aarch64" },
compression: 'xz'
}
assertEquals(useCache().path(stowage2), cache.join("foo∕bar-1.0.0+linux+aarch64.tar.xz"))
const stowage3: Stowage = {
pkg: stowage.pkg,
type: "src",
extname: ".tgz"
}
assertEquals(useCache().path(stowage3), cache.join("foo∕bar-1.0.0.tgz"))
})