MCPcopy Index your code
hub / github.com/jetify-com/devbox / TestOpen

Function TestOpen

internal/devconfig/config_test.go:18–50  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

16)
17
18func TestOpen(t *testing.T) {
19 t.Run("Dir", func(t *testing.T) {
20 root, _, _ := mkNestedDirs(t)
21 if _, err := Init(root); err != nil {
22 t.Fatalf("Init(%q) error: %v", root, err)
23 }
24
25 cfg, err := Open(root)
26 if err != nil {
27 t.Fatalf("Open(%q) error: %v", root, err)
28 }
29 gotDir := filepath.Dir(cfg.Root.AbsRootPath)
30 if gotDir != root {
31 t.Errorf("filepath.Dir(cfg.Root.AbsRootPath) = %q, want %q", gotDir, root)
32 }
33 })
34 t.Run("File", func(t *testing.T) {
35 root, _, _ := mkNestedDirs(t)
36 if _, err := Init(root); err != nil {
37 t.Fatalf("Init(%q) error: %v", root, err)
38 }
39 path := filepath.Join(root, "devbox.json")
40
41 cfg, err := Open(path)
42 if err != nil {
43 t.Fatalf("Open(%q) error: %v", path, err)
44 }
45 gotDir := filepath.Dir(cfg.Root.AbsRootPath)
46 if gotDir != root {
47 t.Errorf("filepath.Dir(cfg.Root.AbsRootPath) = %q, want %q", gotDir, root)
48 }
49 })
50}
51
52func TestOpenError(t *testing.T) {
53 t.Run("NotExist", func(t *testing.T) {

Callers

nothing calls this directly

Calls 4

mkNestedDirsFunction · 0.85
InitFunction · 0.85
OpenFunction · 0.70
RunMethod · 0.65

Tested by

no test coverage detected