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

Function TestExampleLocalPluginAliases

internal/devconfig/config_test.go:368–398  ·  view source on GitHub ↗

TestExampleLocalPluginAliases loads the examples/plugins/local project and verifies that aliases defined in the plugin are merged into the parent config, and that an alias defined in the parent overrides the plugin's.

(t *testing.T)

Source from the content-addressed store, hash-verified

366// verifies that aliases defined in the plugin are merged into the parent
367// config, and that an alias defined in the parent overrides the plugin's.
368func TestExampleLocalPluginAliases(t *testing.T) {
369 exampleDir, err := filepath.Abs(
370 filepath.Join("..", "..", "examples", "plugins", "local"),
371 )
372 if err != nil {
373 t.Fatal(err)
374 }
375
376 cfg, err := Open(exampleDir)
377 if err != nil {
378 t.Fatalf("Open(%q) error: %v", exampleDir, err)
379 }
380
381 lockfile, err := lock.GetFile(&testLockProject{dir: exampleDir})
382 if err != nil {
383 t.Fatalf("lock.GetFile error: %v", err)
384 }
385 if err := cfg.LoadRecursive(lockfile); err != nil {
386 t.Fatalf("LoadRecursive error: %v", err)
387 }
388
389 want := map[string]string{
390 // Parent devbox.json overrides the plugin's "greet" alias.
391 "greet": "echo greeting-from-parent",
392 // "plugin_only" is contributed solely by the plugin.
393 "plugin_only": "echo from-plugin",
394 }
395 if diff := cmp.Diff(want, cfg.Aliases()); diff != "" {
396 t.Errorf("Aliases() mismatch (-want +got):\n%s", diff)
397 }
398}
399
400func TestDefault(t *testing.T) {
401 path := filepath.Join(t.TempDir())

Callers

nothing calls this directly

Calls 4

GetFileFunction · 0.92
LoadRecursiveMethod · 0.80
AliasesMethod · 0.80
OpenFunction · 0.70

Tested by

no test coverage detected