-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathlink.test.ts
44 lines (34 loc) · 1.37 KB
/
link.test.ts
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
33
34
35
36
37
38
39
40
41
42
43
44
import { useTestConfig } from "../hooks/useTestConfig.ts"
import { assert } from "@std/assert"
import SemVer from "../utils/semver.ts"
import link from "./link.ts";
Deno.test({
name: "plumbing.link",
ignore: Deno.build.os == 'windows',
async fn(runner) {
const pkg = {project: 'python.org', version: new SemVer('3.9.0')}
await runner.step("link()", async () => {
const { prefix } = useTestConfig()
const path = prefix.join("python.org/v3.9.0").mkdir('p')
const installation = { pkg, path }
path.join("not-empty").touch()
await link(installation)
await link(installation) // test that calling twice serially works
/// test symlinks work
assert(installation.path.parent().join("v*").isDirectory())
assert(installation.path.parent().join(`v${pkg.version.major}`).isDirectory())
})
await runner.step("link() ×2 at once", async () => {
const { prefix } = useTestConfig()
const path = prefix.join("python.org/v3.9.0").mkdir('p')
const installation = { pkg, path }
path.join("not-empty").touch()
const p1 = link(installation)
const p2 = link(installation)
await Promise.all([p1, p2])
/// test symlinks work
assert(installation.path.parent().join("v*").isDirectory())
assert(installation.path.parent().join(`v${pkg.version.major}`).isDirectory())
})
}
})