Skip to content

Commit 4b2c03a

Browse files
committed
Verify sync with and without git
1 parent 0c7244f commit 4b2c03a

1 file changed

Lines changed: 41 additions & 10 deletions

File tree

tests/functional/sync.test.ts

Lines changed: 41 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,65 @@
11
import { assert } from "deno/testing/asserts.ts"
22
import { createTestHarness } from "./testUtils.ts"
33
import SemVer from "../../src/utils/semver.ts"
4+
import Path from "path"
45

56
Deno.test("update package", { sanitizeResources: false, sanitizeOps: false }, async () => {
67
const {run, TEA_PREFIX } = await createTestHarness()
78

8-
await run(["+sqlite.org=3.39.4"])
9-
9+
await run(["+sqlite.org=3.39.4"])
10+
1011
const expected = TEA_PREFIX.join("sqlite.org").join("v3.39.4")
1112
assert(expected.exists(), "sqlite.org should exist")
1213

13-
await run(["-S", "+sqlite.org"])
14-
14+
await run(["-S", "+sqlite.org"])
15+
1516
const newVersionLink = TEA_PREFIX.join("sqlite.org").join("v*")
1617
assert(newVersionLink.isSymlink())
1718
const newVersion = newVersionLink.readlink().basename()
1819

1920
assert(new SemVer(newVersion).gt(new SemVer("3.39.4")))
2021
})
2122

22-
Deno.test("sync without git on path", { sanitizeResources: false, sanitizeOps: false }, async () => {
23+
Deno.test("sync and update without git on path", { sanitizeResources: false, sanitizeOps: false }, async () => {
2324
const {run, TEA_PREFIX } = await createTestHarness({sync: false})
2425

2526
// empty path so tea can't find git
26-
await run(["-S", "+zlib.net"], { env: { PATH: "" }})
27-
27+
await run(["-S", "+zlib.net"], { env: { PATH: "" }})
28+
2829
const expected = TEA_PREFIX.join("zlib.net")
2930
assert(expected.exists(), "zlib.net should exist")
3031

31-
// update shouldn't go through
32-
// FIXME: test for dispaying the proper warning
33-
await run(["-S", "+zlib.net"], { env: { PATH: "" }})
32+
// allows us to verify that the subsequent update works
33+
TEA_PREFIX.join("tea.xyz/var/pantry/projects/zlib.net").rm({ recursive: true })
34+
35+
await run(["-S", "+zlib.net"], { env: { PATH: "" }})
36+
})
37+
38+
Deno.test("sync without git then update with git", { sanitizeResources: false, sanitizeOps: false }, async () => {
39+
const {run, TEA_PREFIX } = await createTestHarness({sync: false})
40+
41+
// empty path so tea can't find git
42+
await run(["-S", "+zlib.net"], { env: { PATH: "" }})
43+
44+
const expected = TEA_PREFIX.join("zlib.net")
45+
assert(expected.exists(), "zlib.net should exist")
46+
47+
// allows us to verify that the subsequent update works
48+
TEA_PREFIX.join("tea.xyz/var/pantry/projects/zlib.net").rm({ recursive: true })
49+
50+
await run(["-S", "+zlib.net"])
51+
})
52+
53+
Deno.test("sync with git then update without", { sanitizeResources: false, sanitizeOps: false }, async () => {
54+
const {run, TEA_PREFIX } = await createTestHarness({sync: false})
55+
56+
await run(["-S", "+zlib.net"])
57+
58+
const expected = TEA_PREFIX.join("zlib.net")
59+
assert(expected.exists(), "zlib.net should exist")
60+
61+
// allows us to verify that the subsequent update works
62+
TEA_PREFIX.join("tea.xyz/var/pantry/projects/zlib.net").rm({ recursive: true })
63+
64+
await run(["-S", "+zlib.net"], { env: { PATH: "" }})
3465
})

0 commit comments

Comments
 (0)