Files
ProxyPilot/internal/util/translator_test.go
T
RCD 0af0ad14e5 Merge upstream CLIProxyAPI v6.8.28–v6.8.32
Upstream changes:
- Codex responses compaction payload compatibility
- Codex usage_limit_reached retry-after, deterministic parsing
- Codex refresh_token_reused non-retryable fix
- Qwen rate limiting and quota error handling
- Context management compatibility simplification
- Antigravity tool_result image fix, model list backfill, deep copy cache
- Auth auto-refresh interval/concurrency limiting
- Auth hook OnResult refactor (replaces MarkResult)
- Gemini-3.1-flash-image support
- Registry cleanup of outdated model definitions

Fork resolution:
- Accept upstream's consolidated conductor.go (auto-refresh, round-tripper)
- Delete stale conductor_oauth.go, conductor_token.go (upstream reversed split)
- Delete stale provider_rotation_test.go (references removed method)
2026-02-27 20:58:16 +07:00

51 lines
1.2 KiB
Go

package util_test
import (
"testing"
"github.com/router-for-me/CLIProxyAPI/v6/internal/util"
)
func TestNormalizeNullableTypes(t *testing.T) {
tests := []struct {
name string
input string
expected string
}{
{
name: "Simple nullable string",
input: `{"type":["STRING","NULL"]}`,
expected: `{"type":"STRING"}`,
},
{
name: "Nested nullable in properties",
input: `{"parameters":{"type":"object","properties":{"foo":{"type":["STRING","NULL"]}}}}`,
expected: `{"parameters":{"type":"object","properties":{"foo":{"type":"STRING"}}}}`,
},
{
name: "Lowercase null",
input: `{"type":["string","null"]}`,
expected: `{"type":"string"}`,
},
{
name: "Null first",
input: `{"type":["null","STRING"]}`,
expected: `{"type":"STRING"}`,
},
{
name: "Non-nullable type unchanged",
input: `{"type":"STRING"}`,
expected: `{"type":"STRING"}`,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
result := util.NormalizeNullableTypes(tt.input)
if result != tt.expected {
t.Errorf("NormalizeNullableTypes(%s) = %s, want %s", tt.input, result, tt.expected)
}
})
}
}