Release / update-version (push) Has been cancelled
Release / build-frontend (push) Has been cancelled
Release / release (push) Has been cancelled
Release / sync-version-file (push) Has been cancelled
CI / shell (push) Canceled after 0s
CI / test (push) Canceled after 0s
CI / frontend (push) Canceled after 0s
CI / golangci-lint (push) Canceled after 0s
Security Scan / backend-security (push) Canceled after 0s
Security Scan / frontend-security (push) Canceled after 0s
74 lines
1.8 KiB
Go
74 lines
1.8 KiB
Go
package service
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestChannel_IsBedrockCCCompatEnabled_Enabled(t *testing.T) {
|
|
c := &Channel{
|
|
FeaturesConfig: map[string]any{
|
|
featureKeyBedrockCCCompat: true,
|
|
},
|
|
}
|
|
require.True(t, c.IsBedrockCCCompatEnabled("bedrock"))
|
|
}
|
|
|
|
func TestChannel_IsBedrockCCCompatEnabled_AppliesToAllPlatforms(t *testing.T) {
|
|
c := &Channel{
|
|
FeaturesConfig: map[string]any{
|
|
featureKeyBedrockCCCompat: true,
|
|
},
|
|
}
|
|
require.True(t, c.IsBedrockCCCompatEnabled("anthropic"))
|
|
require.True(t, c.IsBedrockCCCompatEnabled("openai"))
|
|
require.True(t, c.IsBedrockCCCompatEnabled(""))
|
|
}
|
|
|
|
func TestChannel_IsBedrockCCCompatEnabled_Disabled(t *testing.T) {
|
|
c := &Channel{
|
|
FeaturesConfig: map[string]any{
|
|
featureKeyBedrockCCCompat: false,
|
|
},
|
|
}
|
|
require.False(t, c.IsBedrockCCCompatEnabled("bedrock"))
|
|
}
|
|
|
|
func TestChannel_IsBedrockCCCompatEnabled_NilFeaturesConfig(t *testing.T) {
|
|
c := &Channel{FeaturesConfig: nil}
|
|
require.False(t, c.IsBedrockCCCompatEnabled("bedrock"))
|
|
}
|
|
|
|
func TestChannel_IsBedrockCCCompatEnabled_NilChannel(t *testing.T) {
|
|
var c *Channel
|
|
require.False(t, c.IsBedrockCCCompatEnabled("bedrock"))
|
|
}
|
|
|
|
func TestChannel_IsBedrockCCCompatEnabled_WrongType(t *testing.T) {
|
|
c := &Channel{
|
|
FeaturesConfig: map[string]any{
|
|
featureKeyBedrockCCCompat: "yes",
|
|
},
|
|
}
|
|
require.False(t, c.IsBedrockCCCompatEnabled("bedrock"))
|
|
}
|
|
|
|
func TestChannel_IsBedrockCCCompatEnabled_OldMapFormat(t *testing.T) {
|
|
c := &Channel{
|
|
FeaturesConfig: map[string]any{
|
|
featureKeyBedrockCCCompat: map[string]any{"bedrock": true},
|
|
},
|
|
}
|
|
require.False(t, c.IsBedrockCCCompatEnabled("bedrock"))
|
|
}
|
|
|
|
func TestChannel_IsBedrockCCCompatEnabled_MissingKey(t *testing.T) {
|
|
c := &Channel{
|
|
FeaturesConfig: map[string]any{
|
|
"other_feature": true,
|
|
},
|
|
}
|
|
require.False(t, c.IsBedrockCCCompatEnabled("bedrock"))
|
|
}
|