Something went wrong. Try again.
small gleam coding and persistent agent daemon with a detachable cli and a canvas ui forked from okami.mom/albedo
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637package config
import "testing"
func TestSettingsValidatePreservesBedrockAPI(t *testing.T) { for _, api := range []string{"", "messages", "converse"} { t.Run(api, func(t *testing.T) { settings := Settings{Extension: "bedrock", API: api, Model: " amazon.nova-pro-v1:0 ", Protocol: "chat_completions", AccountIDs: []string{"first", "second"}} validated, err := settings.Validate() if err != nil { t.Fatal(err) } if len(validated.AccountIDs) != 2 || validated.AccountIDs[0] != "first" || validated.AccountIDs[1] != "second" || validated.AccountID != nil || validated.API != api || validated.Extension != "bedrock" || validated.Model != "amazon.nova-pro-v1:0" || validated.Protocol != "chat_completions" { t.Fatalf("validation changed provider API or replay protocol: %+v", validated) } }) }}
func TestSettingsValidateRejectsUnknownBedrockAPI(t *testing.T) { for _, api := range []string{"converse_stream", "Converse", " converse", "converse ", "responses", "invoke_model", "messages\n"} { t.Run(api, func(t *testing.T) { _, err := (Settings{Extension: "bedrock", API: api, Model: "fixture", Protocol: "chat_completions"}).Validate() if err == nil { t.Fatalf("accepted unknown Bedrock API %q", api) } }) }}
func TestSettingsValidatePreservesOtherExtensionAPI(t *testing.T) { got, err := (Settings{Extension: "fixture-extension", API: "extension-owned", Model: "fixture", Protocol: "responses"}).Validate() if err != nil || got.API != "extension-owned" { t.Fatalf("lost unrelated extension API: %+v, %v", got, err) }}