Skip to content

test(dify-ui): remove brittle primitive assertions#38529

Merged
lyzno1 merged 1 commit into
mainfrom
codex/dify-ui-test-best-practices
Jul 8, 2026
Merged

test(dify-ui): remove brittle primitive assertions#38529
lyzno1 merged 1 commit into
mainfrom
codex/dify-ui-test-best-practices

Conversation

@lyzno1

@lyzno1 lyzno1 commented Jul 8, 2026

Copy link
Copy Markdown
Member

Summary

  • replace low-value Avatar tests with a real image loading status callback contract
  • remove brittle ProgressCircle SVG path assertions and keep the test focused on progressbar semantics
  • remove an unnecessary type assertion in the Avatar empty-string case

Testing

  • pnpm -C packages/dify-ui exec vp test run --project unit src/avatar/tests/index.spec.tsx src/progress/tests/index.spec.tsx --silent=passed-only
  • pnpm -C packages/dify-ui exec vp test run --project unit --silent=passed-only
  • pnpm -C packages/dify-ui type-check
  • pnpm eslint packages/dify-ui/src/avatar/tests/index.spec.tsx packages/dify-ui/src/progress/tests/index.spec.tsx
  • git diff --check

Notes

Aligned with the React testing guidance to avoid tests that cannot fail meaningfully, avoid implementation-detail assertions, prefer observable contracts, and keep test code type-safe.

@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jul 8, 2026
@lyzno1 lyzno1 enabled auto-merge July 8, 2026 03:17
@github-actions github-actions Bot added the web This relates to changes on the web. label Jul 8, 2026
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Jul 8, 2026
@codecov

codecov Bot commented Jul 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.33%. Comparing base (ee0068e) to head (1cd116a).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #38529      +/-   ##
==========================================
- Coverage   85.34%   85.33%   -0.01%     
==========================================
  Files        5012     5012              
  Lines      265775   265775              
  Branches    50519    50519              
==========================================
- Hits       226813   226812       -1     
- Misses      34512    34513       +1     
  Partials     4450     4450              
Flag Coverage Δ
dify-ui 94.61% <ø> (-0.11%) ⬇️
web 84.89% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@lyzno1 lyzno1 added this pull request to the merge queue Jul 8, 2026
Merged via the queue into main with commit 6c0aa3e Jul 8, 2026
38 checks passed
@lyzno1 lyzno1 deleted the codex/dify-ui-test-best-practices branch July 8, 2026 03:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer size:XS This PR changes 0-9 lines, ignoring generated files. web This relates to changes on the web.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants