deno.land / x / trex@v1.13.1 / test / core.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
import { customPackage, installPackages } from "../handlers/handle_packages.ts";import { deletepackage } from "../handlers/delete_package.ts";import { isCachePackage } from "../handlers/handle_cache.ts";import { HelpCommand, LogPackages } from "../utils/logs.ts";import { getImportMap } from "../handlers/handle_files.ts";import { packageTreeInfo } from "../tools/logs.ts";import { importMap } from "../utils/types.ts";import { Merlin } from "merlin";
const Test = new Merlin();
Test.assertEqual("install custom package from raw github link", { async expect(): Promise<boolean> { const data = await customPackage( [ "--custom", "merlin=https://raw.githubusercontent.com/crewdevio/merlin/master/mod.ts", ], false, );
return data; }, toBe(): boolean { return true; }, Ops: false, Resources: false,});
Test.assertEqual("install dinoenv@v1.1.0 package from deno.land", { async expect() { const pkg = await installPackages( ["install", "--map", "dinoenv@v1.1.0"], false, ); return pkg; }, toBe() { return { dinoenv: "https://deno.land/x/dinoenv@v1.1.0/mod.ts" }; }, ignore: true, Ops: false, Resources: false,});
Test.assertEqual("install dinoenv package from nest.land", { async expect() { const pkg = await installPackages(["i", "--nest", "dinoenv@1.0.0"], false);
return pkg; }, toBe() { return { dinoenv: "https://arweave.net/Rru09TE8WVU_0eMY5lWAM6xsZxbVDScnqkrGvZPjEs4/mod.ts", }; }, Ops: false, Resources: false, ignore: true,});
Test.isUndefined("trex treeDeps test", { async value() { return (await packageTreeInfo( ...["--unstable", "treeDeps", "react"], )) as undefined; }, Ops: false, Resources: false,});
Test.isUndefined("Command helper test", { value() { return HelpCommand({ command: { alias: ["install", "i"], description: "install a package", }, flags: [ { alias: ["--map", "-m"], description: "install package from deno.land", }, { alias: ["--nest", "-n"], description: "install package from nest.land", }, { alias: ["--pkg", "-p"], description: "install package from some repository", }, { alias: ["--help, -h"], description: "show command help" }, ], }); }, Ops: false, Resources: false,});
Test.assertEqual("is cache package", { async expect() { const data = await isCachePackage( "https://raw.githubusercontent.com/crewdevio/merlin/master/mod.ts", );
return data.exist; },
toBe() { return true; }, Ops: false, Resources: false,});
Test.isString("is cache package path", { async value() { const data = await isCachePackage( "https://raw.githubusercontent.com/crewdevio/merlin/master/mod.ts", );
return data.path; }, Ops: false, Resources: false,});
Test.isUndefined("delete package", { async value() { const response = await deletepackage("merlin");
return response; }, // ignore: true, Ops: false, Resources: false,});
Test.isUndefined("ls command", { async value() { const map = (await getImportMap<importMap>())!; return LogPackages(map?.imports, false); }, Ops: false, Resources: false,});
trex

Version Info

Tagged at
9 months ago