1
0

Merge branch 'dev-frontend-optimization'

This commit is contained in:
2026-04-22 13:31:37 +08:00
26 changed files with 154 additions and 175 deletions

View File

@@ -255,7 +255,7 @@ func TestProviderService_Update_Success(t *testing.T) {
})
require.NoError(t, err)
updated, err := svc.Get("openai", false)
updated, err := svc.Get("openai")
require.NoError(t, err)
assert.Equal(t, "OpenAI Updated", updated.Name)
}
@@ -425,9 +425,9 @@ func TestProviderService_isUniqueConstraintError(t *testing.T) {
}
}
// ============ ProviderService - List MaskAPIKey 测试 ============
// ============ ProviderService - List API Key 测试 ============
func TestProviderService_List_MaskAPIKey(t *testing.T) {
func TestProviderService_List_APIKeyNotMasked(t *testing.T) {
db := setupServiceTestDB(t)
repo := repository.NewProviderRepository(db)
modelRepo := repository.NewModelRepository(db)
@@ -442,9 +442,13 @@ func TestProviderService_List_MaskAPIKey(t *testing.T) {
require.NoError(t, err)
require.Len(t, providers, 2)
expectedKeys := map[string]string{
"openai": "sk-1234567890",
"anthropic": "sk-anthropic1234",
}
for _, p := range providers {
assert.Contains(t, p.APIKey, "***")
assert.Len(t, p.APIKey, 7)
assert.NotContains(t, p.APIKey, "***")
assert.Equal(t, expectedKeys[p.ID], p.APIKey)
}
}