mirror of
https://github.com/xaionaro-go/streamctl.git
synced 2025-09-27 11:52:11 +08:00
46 lines
855 B
Go
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))
|
|
}
|