(t *testing.T)
| 449 | } |
| 450 | |
| 451 | func TestCallbackPath(t *testing.T) { |
| 452 | testDataDir := t.TempDir() |
| 453 | conf := config.Config{DataDir: testDataDir} |
| 454 | _, err := repotest.InstallPlugin("dummy_plugin", testDataDir, testPluginName) |
| 455 | assert.Nil(t, err) |
| 456 | plugin := New(conf, testPluginName) |
| 457 | |
| 458 | t.Run("returns callback path when callback exists", func(t *testing.T) { |
| 459 | path, err := plugin.CallbackPath("install") |
| 460 | assert.Nil(t, err) |
| 461 | assert.Equal(t, filepath.Base(path), "install") |
| 462 | assert.Equal(t, filepath.Base(filepath.Dir(filepath.Dir(path))), plugin.Name) |
| 463 | assert.Equal(t, filepath.Base(filepath.Dir(filepath.Dir(filepath.Dir(path)))), "plugins") |
| 464 | }) |
| 465 | |
| 466 | t.Run("returns error when callback does not exist", func(t *testing.T) { |
| 467 | path, err := plugin.CallbackPath("non-existent") |
| 468 | assert.Equal(t, err.(NoCallbackError).Error(), "Plugin named lua does not have a callback named non-existent") |
| 469 | assert.Equal(t, path, "") |
| 470 | }) |
| 471 | } |
| 472 | |
| 473 | func TestGetExtensionCommands(t *testing.T) { |
| 474 | testDataDir := t.TempDir() |
nothing calls this directly
no test coverage detected