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

Function TestComputeDevboxPathIsIdempotent

internal/devbox/devbox_test.go:78–97  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

76}
77
78func TestComputeDevboxPathIsIdempotent(t *testing.T) {
79 devbox := devboxForTesting(t)
80 devbox.nix = &testNix{"/tmp/my/path"}
81 ctx := t.Context()
82 env, err := devbox.computeEnv(ctx, false /*use cache*/, devopt.EnvOptions{})
83 require.NoError(t, err, "computeEnv should not fail")
84 path := env["PATH"]
85 assert.NotEmpty(t, path, "path should not be nil")
86
87 t.Setenv("PATH", path)
88 t.Setenv(envpath.InitPathEnv, env[envpath.InitPathEnv])
89 t.Setenv(envpath.PathStackEnv, env[envpath.PathStackEnv])
90 t.Setenv(envpath.Key(devbox.ProjectDirHash()), env[envpath.Key(devbox.ProjectDirHash())])
91
92 env, err = devbox.computeEnv(ctx, false /*use cache*/, devopt.EnvOptions{})
93 require.NoError(t, err, "computeEnv should not fail")
94 path2 := env["PATH"]
95
96 assert.Equal(t, path, path2, "path should be the same")
97}
98
99func TestComputeDevboxPathWhenRemoving(t *testing.T) {
100 devbox := devboxForTesting(t)

Callers

nothing calls this directly

Calls 4

KeyFunction · 0.92
devboxForTestingFunction · 0.85
computeEnvMethod · 0.80
ProjectDirHashMethod · 0.80

Tested by

no test coverage detected