-
Notifications
You must be signed in to change notification settings - Fork 134
Expand file tree
/
Copy pathRegistry.purs
More file actions
62 lines (52 loc) · 2.43 KB
/
Copy pathRegistry.purs
File metadata and controls
62 lines (52 loc) · 2.43 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
module Test.Spago.Registry where
import Test.Prelude
import Data.Array as Array
import Data.String (Pattern(..))
import Data.String as String
import Test.Spec (Spec)
import Test.Spec as Spec
spec :: Spec Unit
spec = Spec.parallel $ Spec.around withTempDir do
Spec.describe "registry" do
Spec.it "list package sets" \{ spago, fixture } -> do
result <- spago [ "registry", "package-sets" ]
let
updateStdout r = r
{ stdout = r.stdout
-- Take the oldest lines of output - the list of package sets will grow all the time
# String.split (Pattern "\n")
# Array.take 200
# String.joinWith "\n"
}
shouldBeSuccessOutput (fixture "registry-list-package-sets.txt") $ bimap updateStdout updateStdout result
Spec.it "list only latest package sets for compiler" \{ spago, fixture } -> do
result <- spago [ "registry", "package-sets", "--latest" ]
let
updateStdout r = r
{ stdout = r.stdout
-- Take the oldest lines of output - the list of package sets will grow all the time
# String.split (Pattern "\n")
# Array.take 7
# String.joinWith "\n"
}
shouldBeSuccessOutput (fixture "registry-list-package-sets-latest.txt") $ bimap updateStdout updateStdout result
Spec.it "query package sets and package info with set associations" \{ spago, fixture } -> do
-- Test: List packages in a specific package set (table output)
do
result <- spago [ "registry", "package-sets", "0.0.1" ]
let
updateStdout r = r
{ stdout = r.stdout
# String.split (Pattern "\n")
# Array.take 50
# String.joinWith "\n"
}
shouldBeSuccessOutput (fixture "registry-package-set-0.0.1.txt") $ bimap updateStdout updateStdout result
-- Test: List packages in a specific package set (JSON output)
spago [ "registry", "package-sets", "0.0.1", "--json" ] >>= shouldBeSuccess
-- Test: Error for non-existent package set version
spago [ "registry", "package-sets", "999.999.999" ] >>= shouldBeFailure
-- Test: Info command shows package sets for versions (text output)
spago [ "registry", "info", "prelude" ] >>= shouldBeSuccess
-- Test: Info command with JSON includes package sets
spago [ "registry", "info", "prelude", "--json" ] >>= shouldBeSuccess