[PR #32358] test(web): Added test for model-auth files in header folder #33689

Open
opened 2026-02-21 20:53:43 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/32358

State: open
Merged: No


Checklist

  • This change requires a documentation update
  • I’ve added/updated tests for the behavior covered in this change
  • I ran lint, type-check, tests, and coverage for the updated model-auth specs
  • No backend/API code paths were changed

Unit Test Added Summary

Added/Updated spec files

  • web/app/components/header/account-setting/model-provider-page/model-auth/add-credential-in-load-balancing.spec.tsx (new)
  • web/app/components/header/account-setting/model-provider-page/model-auth/add-custom-model.spec.tsx (new)
  • web/app/components/header/account-setting/model-provider-page/model-auth/authorized/authorized-item.spec.tsx (new)
  • web/app/components/header/account-setting/model-provider-page/model-auth/authorized/credential-item.spec.tsx (new)
  • web/app/components/header/account-setting/model-provider-page/model-auth/authorized/index.spec.tsx (new)
  • web/app/components/header/account-setting/model-provider-page/model-auth/config-model.spec.tsx (new)
  • web/app/components/header/account-setting/model-provider-page/model-auth/config-provider.spec.tsx (new)
  • web/app/components/header/account-setting/model-provider-page/model-auth/credential-selector.spec.tsx (new)
  • web/app/components/header/account-setting/model-provider-page/model-auth/hooks/use-auth-service..spec.tsx (new)
  • web/app/components/header/account-setting/model-provider-page/model-auth/hooks/use-auth.spec.tsx (new)
  • web/app/components/header/account-setting/model-provider-page/model-auth/hooks/use-credential-data.spec.tsx (new)
  • web/app/components/header/account-setting/model-provider-page/model-auth/hooks/use-credential-status.spec.tsx (new)
  • web/app/components/header/account-setting/model-provider-page/model-auth/hooks/use-custom-models.spec.tsx (new)
  • web/app/components/header/account-setting/model-provider-page/model-auth/hooks/use-model-form-schemas.spec.tsx (new)
  • web/app/components/header/account-setting/model-provider-page/model-auth/manage-custom-model-credentials.spec.tsx (new)
  • web/app/components/header/account-setting/model-provider-page/model-auth/switch-credential-in-load-balancing.spec.tsx (new)

Barrel-file test cleanup

  • Removed: web/app/components/header/account-setting/model-provider-page/model-auth/index.spec.tsx

Validation Run

Lint

pnpm --dir web lint app/components/header/account-setting/model-provider-page/model-auth/**/*.spec.tsx
  • Result: Passed

Type Check

pnpm --dir web type-check:tsgo
  • Result: Passed

Tests

pnpm --dir web test app/components/header/account-setting/model-provider-page/model-auth
  • Result: Passed (85/85 tests)

Coverage

pnpm --dir web test:coverage app/components/header/account-setting/model-provider-page/model-auth
  • Result: Passed

Coverage Report (model-auth source files)

File Status in this update Statements Branches Functions Lines
web/app/components/header/account-setting/model-provider-page/model-auth/add-credential-in-load-balancing.tsx Covered in current update 100.00% 78.57% 100.00% 100.00%
web/app/components/header/account-setting/model-provider-page/model-auth/add-custom-model.tsx Covered in current update 100.00% 100.00% 100.00% 100.00%
web/app/components/header/account-setting/model-provider-page/model-auth/authorized/authorized-item.tsx Covered in current update 100.00% 100.00% 100.00% 100.00%
web/app/components/header/account-setting/model-provider-page/model-auth/authorized/credential-item.tsx Covered in current update 100.00% 86.84% 100.00% 100.00%
web/app/components/header/account-setting/model-provider-page/model-auth/authorized/index.tsx Covered in current update 100.00% 93.54% 100.00% 100.00%
web/app/components/header/account-setting/model-provider-page/model-auth/config-model.tsx Covered in current update 100.00% 100.00% 100.00% 100.00%
web/app/components/header/account-setting/model-provider-page/model-auth/config-provider.tsx Covered in current update 100.00% 81.25% 100.00% 100.00%
web/app/components/header/account-setting/model-provider-page/model-auth/credential-selector.tsx Covered in current update 100.00% 91.66% 100.00% 100.00%
web/app/components/header/account-setting/model-provider-page/model-auth/hooks/use-auth-service.ts Covered in current update 100.00% 100.00% 100.00% 100.00%
web/app/components/header/account-setting/model-provider-page/model-auth/hooks/use-auth.ts Covered in current update 97.36% 85.18% 100.00% 97.36%
web/app/components/header/account-setting/model-provider-page/model-auth/hooks/use-credential-data.ts Covered in current update 100.00% 100.00% 100.00% 100.00%
web/app/components/header/account-setting/model-provider-page/model-auth/hooks/use-credential-status.ts Covered in current update 100.00% 100.00% 100.00% 100.00%
web/app/components/header/account-setting/model-provider-page/model-auth/hooks/use-custom-models.ts Covered in current update 100.00% 100.00% 100.00% 100.00%
web/app/components/header/account-setting/model-provider-page/model-auth/hooks/use-model-form-schemas.ts Covered in current update 100.00% 100.00% 100.00% 100.00%
web/app/components/header/account-setting/model-provider-page/model-auth/manage-custom-model-credentials.tsx Covered in current update 100.00% 87.50% 100.00% 100.00%
web/app/components/header/account-setting/model-provider-page/model-auth/switch-credential-in-load-balancing.tsx Covered in current update 100.00% 87.17% 100.00% 100.00%

Issue Fixes - #32357

**Original Pull Request:** https://github.com/langgenius/dify/pull/32358 **State:** open **Merged:** No --- ## Checklist - [ ] This change requires a documentation update - [x] I’ve added/updated tests for the behavior covered in this change - [x] I ran lint, type-check, tests, and coverage for the updated `model-auth` specs - [x] No backend/API code paths were changed ## Unit Test Added Summary ### Added/Updated spec files - `web/app/components/header/account-setting/model-provider-page/model-auth/add-credential-in-load-balancing.spec.tsx` (new) - `web/app/components/header/account-setting/model-provider-page/model-auth/add-custom-model.spec.tsx` (new) - `web/app/components/header/account-setting/model-provider-page/model-auth/authorized/authorized-item.spec.tsx` (new) - `web/app/components/header/account-setting/model-provider-page/model-auth/authorized/credential-item.spec.tsx` (new) - `web/app/components/header/account-setting/model-provider-page/model-auth/authorized/index.spec.tsx` (new) - `web/app/components/header/account-setting/model-provider-page/model-auth/config-model.spec.tsx` (new) - `web/app/components/header/account-setting/model-provider-page/model-auth/config-provider.spec.tsx` (new) - `web/app/components/header/account-setting/model-provider-page/model-auth/credential-selector.spec.tsx` (new) - `web/app/components/header/account-setting/model-provider-page/model-auth/hooks/use-auth-service..spec.tsx` (new) - `web/app/components/header/account-setting/model-provider-page/model-auth/hooks/use-auth.spec.tsx` (new) - `web/app/components/header/account-setting/model-provider-page/model-auth/hooks/use-credential-data.spec.tsx` (new) - `web/app/components/header/account-setting/model-provider-page/model-auth/hooks/use-credential-status.spec.tsx` (new) - `web/app/components/header/account-setting/model-provider-page/model-auth/hooks/use-custom-models.spec.tsx` (new) - `web/app/components/header/account-setting/model-provider-page/model-auth/hooks/use-model-form-schemas.spec.tsx` (new) - `web/app/components/header/account-setting/model-provider-page/model-auth/manage-custom-model-credentials.spec.tsx` (new) - `web/app/components/header/account-setting/model-provider-page/model-auth/switch-credential-in-load-balancing.spec.tsx` (new) ### Barrel-file test cleanup - Removed: `web/app/components/header/account-setting/model-provider-page/model-auth/index.spec.tsx` ## Validation Run ### Lint ```bash pnpm --dir web lint app/components/header/account-setting/model-provider-page/model-auth/**/*.spec.tsx ``` - Result: ✅ Passed ### Type Check ```bash pnpm --dir web type-check:tsgo ``` - Result: ✅ Passed ### Tests ```bash pnpm --dir web test app/components/header/account-setting/model-provider-page/model-auth ``` - Result: ✅ Passed (85/85 tests) ### Coverage ```bash pnpm --dir web test:coverage app/components/header/account-setting/model-provider-page/model-auth ``` - Result: ✅ Passed ## Coverage Report (`model-auth` source files) | File | Status in this update | Statements | Branches | Functions | Lines | |---|---|---:|---:|---:|---:| | `web/app/components/header/account-setting/model-provider-page/model-auth/add-credential-in-load-balancing.tsx` | Covered in current update | 100.00% | 78.57% | 100.00% | 100.00% | | `web/app/components/header/account-setting/model-provider-page/model-auth/add-custom-model.tsx` | Covered in current update | 100.00% | 100.00% | 100.00% | 100.00% | | `web/app/components/header/account-setting/model-provider-page/model-auth/authorized/authorized-item.tsx` | Covered in current update | 100.00% | 100.00% | 100.00% | 100.00% | | `web/app/components/header/account-setting/model-provider-page/model-auth/authorized/credential-item.tsx` | Covered in current update | 100.00% | 86.84% | 100.00% | 100.00% | | `web/app/components/header/account-setting/model-provider-page/model-auth/authorized/index.tsx` | Covered in current update | 100.00% | 93.54% | 100.00% | 100.00% | | `web/app/components/header/account-setting/model-provider-page/model-auth/config-model.tsx` | Covered in current update | 100.00% | 100.00% | 100.00% | 100.00% | | `web/app/components/header/account-setting/model-provider-page/model-auth/config-provider.tsx` | Covered in current update | 100.00% | 81.25% | 100.00% | 100.00% | | `web/app/components/header/account-setting/model-provider-page/model-auth/credential-selector.tsx` | Covered in current update | 100.00% | 91.66% | 100.00% | 100.00% | | `web/app/components/header/account-setting/model-provider-page/model-auth/hooks/use-auth-service.ts` | Covered in current update | 100.00% | 100.00% | 100.00% | 100.00% | | `web/app/components/header/account-setting/model-provider-page/model-auth/hooks/use-auth.ts` | Covered in current update | 97.36% | 85.18% | 100.00% | 97.36% | | `web/app/components/header/account-setting/model-provider-page/model-auth/hooks/use-credential-data.ts` | Covered in current update | 100.00% | 100.00% | 100.00% | 100.00% | | `web/app/components/header/account-setting/model-provider-page/model-auth/hooks/use-credential-status.ts` | Covered in current update | 100.00% | 100.00% | 100.00% | 100.00% | | `web/app/components/header/account-setting/model-provider-page/model-auth/hooks/use-custom-models.ts` | Covered in current update | 100.00% | 100.00% | 100.00% | 100.00% | | `web/app/components/header/account-setting/model-provider-page/model-auth/hooks/use-model-form-schemas.ts` | Covered in current update | 100.00% | 100.00% | 100.00% | 100.00% | | `web/app/components/header/account-setting/model-provider-page/model-auth/manage-custom-model-credentials.tsx` | Covered in current update | 100.00% | 87.50% | 100.00% | 100.00% | | `web/app/components/header/account-setting/model-provider-page/model-auth/switch-credential-in-load-balancing.tsx` | Covered in current update | 100.00% | 87.17% | 100.00% | 100.00% | Issue Fixes - #32357 ```
yindo added the pull-request label 2026-02-21 20:53:43 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#33689