Files
streamctl/pkg/streamcontrol/registry_test.go
2024-10-21 23:10:01 +01:00

46 lines
855 B
Go

package streamcontrol
import (
"testing"
"github.com/stretchr/testify/require"
)
const mockPlatformID = "mock-platform"
type mockPlatformSpecificConfig struct {
SomeWackyData []byte
}
func (mockPlatformSpecificConfig) IsInitialized() bool {
return true
}
type mockStreamProfile struct {
Hello string
}
func (mockStreamProfile) GetParent() (ProfileName, bool) {
return "", false
}
func (mockStreamProfile) GetOrder() int {
return 0
}
func TestRegistry(
t *testing.T,
) {
RegisterPlatform[mockPlatformSpecificConfig, mockStreamProfile](mockPlatformID)
cfg := Config{
mockPlatformID: &AbstractPlatformConfig{
Enable: ptr(true),
Config: RawMessage("{}"),
StreamProfiles: map[ProfileName]AbstractStreamProfile{},
Custom: map[string]any{},
},
}
require.True(t, IsInitialized(cfg, mockPlatformID))
}