Add projects
This commit is contained in:
parent
2d3a9ad623
commit
8b607dd700
1802 changed files with 503346 additions and 2 deletions
40
backend/sdk/cliproxy/auth/selected_auth_metadata_test.go
Normal file
40
backend/sdk/cliproxy/auth/selected_auth_metadata_test.go
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
package auth
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
cliproxyexecutor "github.com/router-for-me/CLIProxyAPI/v7/sdk/cliproxy/executor"
|
||||
)
|
||||
|
||||
func TestPublishSelectedAuthMetadataIncludesStableIndex(t *testing.T) {
|
||||
auth := &Auth{
|
||||
ID: "auth-1",
|
||||
Provider: "codex",
|
||||
FileName: "auth-1.json",
|
||||
}
|
||||
selectedAuthID := ""
|
||||
selectedAuthIndex := ""
|
||||
meta := map[string]any{
|
||||
cliproxyexecutor.SelectedAuthCallbackMetadataKey: func(authID string) {
|
||||
selectedAuthID = authID
|
||||
},
|
||||
cliproxyexecutor.SelectedAuthIndexCallbackMetadataKey: func(authIndex string) {
|
||||
selectedAuthIndex = authIndex
|
||||
},
|
||||
}
|
||||
|
||||
publishSelectedAuthMetadata(meta, auth)
|
||||
|
||||
if selectedAuthID != auth.ID {
|
||||
t.Fatalf("selected auth ID = %q, want %q", selectedAuthID, auth.ID)
|
||||
}
|
||||
if selectedAuthIndex == "" || selectedAuthIndex != auth.Index {
|
||||
t.Fatalf("selected auth index = %q, want %q", selectedAuthIndex, auth.Index)
|
||||
}
|
||||
if got := meta[cliproxyexecutor.SelectedAuthMetadataKey]; got != auth.ID {
|
||||
t.Fatalf("selected auth metadata = %#v, want %q", got, auth.ID)
|
||||
}
|
||||
if got := meta[cliproxyexecutor.SelectedAuthIndexMetadataKey]; got != auth.Index {
|
||||
t.Fatalf("selected auth index metadata = %#v, want %q", got, auth.Index)
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue