package providers import ( "testing" "github.com/qdm12/gluetun/pkg/updaters" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) func Test_All(t *testing.T) { t.Parallel() all := All() assert.NotContains(t, all, Custom) assert.NotEmpty(t, all) } func Test_AllWithCustom(t *testing.T) { t.Parallel() all := AllWithCustom() assert.Contains(t, all, Custom) assert.Len(t, all, len(All())+1) } func Test_MatchUpdaters(t *testing.T) { t.Parallel() fetcherNames := updaters.ListAllNames() allProviders := All() require.Equal(t, len(allProviders), len(fetcherNames), "number of providers in All() should match number of fetchers") nameToFound := make(map[string]bool, len(allProviders)) for _, provider := range allProviders { nameToFound[provider] = false } for _, fetcherName := range fetcherNames { found, ok := nameToFound[fetcherName] require.True(t, ok, "fetcher name %q not found in %v", fetcherName, allProviders) require.False(t, found, "fetcher name %q is duplicated in %v", fetcherName, allProviders) nameToFound[fetcherName] = true } for provider, found := range nameToFound { assert.True(t, found, "provider %q from All() does not have a matching fetcher", provider) } }