package builtin import ( "testing" "drivervault/apiserver/internal/plugins" ) // The blank imports above are the whole content of this package, and forgetting // one is a silent failure: the connector compiles, its tests pass, and it simply // never appears in the panel. This pins the list. func TestEveryBuiltinIsRegistered(t *testing.T) { // List needs no store: it reports the registered factories, and the records // it would merge in come from a Manager that has loaded. views := plugins.NewManager(nil).List() seen := map[string]plugins.View{} for _, v := range views { seen[v.Name] = v } want := map[string]string{ "anker-solix": plugins.CategoryChargers, "apprise": plugins.CategoryNotifications, "greencell": plugins.CategoryChargers, "toyota": plugins.CategoryVehicles, } for name, category := range want { v, ok := seen[name] if !ok { t.Errorf("%q is not registered — is it blank-imported in builtin.go?", name) continue } if v.Kind != plugins.KindBuiltin { t.Errorf("%q kind = %q, want builtin", name, v.Kind) } if v.Category != category { t.Errorf("%q category = %q, want %q", name, v.Category, category) } if v.Provider == "" || v.Version == "" { t.Errorf("%q should name a provider and a version, got %q / %q", name, v.Provider, v.Version) } if len(v.Capabilities) == 0 { t.Errorf("%q advertises no capabilities", name) } } if len(seen) != len(want) { t.Errorf("registered builtins = %d, expected %d — update this test with the new connector", len(seen), len(want)) } }