Skip to content

Commit

Permalink
Added test for invalid account
Browse files Browse the repository at this point in the history
  • Loading branch information
akclace committed Jan 14, 2024
1 parent f6f7edc commit 95c825e
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions internal/app/app_plugins_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ func TestGetPlugin(t *testing.T) {
}

// Test with account, with no account link
pluginInfo.moduleName = "plugin2"
pluginInfo.pluginPath = "plugin2.in#account1"
pluginInfo.builder = func(pluginContext *PluginContext) (any, error) {
testutil.AssertEqualsString(t, "match key", "v4", pluginContext.Config["key"].(string))
Expand All @@ -72,7 +71,6 @@ func TestGetPlugin(t *testing.T) {
}

// Test with account, with account link
pluginInfo.moduleName = "plugin2"
pluginInfo.pluginPath = "plugin2.in#account2"
pluginInfo.builder = func(pluginContext *PluginContext) (any, error) {
testutil.AssertEqualsString(t, "match key", "v6", pluginContext.Config["key"].(string))
Expand All @@ -83,4 +81,17 @@ func TestGetPlugin(t *testing.T) {
if plugin != appPlugins.plugins[pluginInfo.moduleName] {
t.Errorf("Expected %v, got %v", appPlugins.plugins[pluginInfo.moduleName], plugin)
}

// Test with invalid account
pluginInfo.pluginPath = "plugin2.in#invalid"
pluginInfo.builder = func(pluginContext *PluginContext) (any, error) {
// Config should have no entries
testutil.AssertEqualsInt(t, "match key", 0, len(pluginContext.Config))
return nil, nil
}
plugin, err = appPlugins.GetPlugin(pluginInfo, "")
testutil.AssertNoError(t, err)
if plugin != appPlugins.plugins[pluginInfo.moduleName] {
t.Errorf("Expected %v, got %v", appPlugins.plugins[pluginInfo.moduleName], plugin)
}
}

0 comments on commit 95c825e

Please sign in to comment.