MCPcopy Create free account
hub / github.com/celer-pkg/celer / TestTreeCmd_PrintTree

Function TestTreeCmd_PrintTree

cmds/cmd_tree_test.go:181–225  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

179}
180
181func TestTreeCmd_PrintTree(t *testing.T) {
182 // Cleanup.
183 dirs.RemoveAllForTest()
184
185 treeCmd := treeCmd{}
186
187 // Create a simple dependency tree
188 root := &portInfo{
189 nameVersion: "root@1.0.0",
190 depth: 0,
191 devDep: false,
192 }
193
194 dep1 := &portInfo{
195 parent: root,
196 nameVersion: "dep1@1.0.0",
197 depth: 1,
198 devDep: false,
199 }
200
201 dep2 := &portInfo{
202 parent: root,
203 nameVersion: "dep2@2.0.0",
204 depth: 1,
205 devDep: false,
206 }
207
208 devDep := &portInfo{
209 parent: root,
210 nameVersion: "devdep@1.0.0",
211 depth: 1,
212 devDep: true,
213 }
214
215 root.depedencies = []*portInfo{dep1, dep2}
216 root.devDependencies = []*portInfo{devDep}
217
218 // Test without hiding dev dependencies.
219 treeCmd.hideDevDep = false
220 treeCmd.printTree(root) // Should not panic
221
222 // Test with hiding dev dependencies.
223 treeCmd.hideDevDep = true
224 treeCmd.printTree(root) // Should not panic
225}
226
227func TestTreeCmd_CollectPortInfos(t *testing.T) {
228 // Cleanup.

Callers

nothing calls this directly

Calls 2

printTreeMethod · 0.95
RemoveAllForTestFunction · 0.92

Tested by

no test coverage detected