Skip to content

test: optimize UI tests by removing trivial and mock-focused tests - #34

Closed
GoBeromsu wants to merge 2 commits into
masterfrom
test/optimize-ui-tests
Closed

test: optimize UI tests by removing trivial and mock-focused tests#34
GoBeromsu wants to merge 2 commits into
masterfrom
test/optimize-ui-tests

Conversation

@GoBeromsu

Copy link
Copy Markdown
Owner

Summary

  • Removed 2 test files that only verified mock behavior without testing actual logic
  • Removed trivial "Basic Rendering" test sections from 2 container test files
  • Kept all tests that verify actual UI component behavior and critical regression scenarios

Changes

Deleted Files

  • __tests__/ui/components/common/CommonButton.test.ts (54 lines)

    • Only tested that mock methods were called (setButtonText, setIcon, etc.)
    • No actual UI logic validation
  • __tests__/ui/containers/Api.test.ts (165 lines)

    • Tests only verified trivial data assignments
    • Tests verified mock function behavior instead of actual API container logic

Modified Files

  • __tests__/ui/containers/Frontmatter.test.ts

    • Removed: 31 lines of trivial "Basic Rendering" tests
    • Kept: Critical regression tests for template filtering (id=0), delete, and edit logic
  • __tests__/ui/containers/Tag.test.ts

    • Removed: 16 lines of trivial "Basic Rendering" test
    • Kept: Critical regression tests for tag setting updates and error handling

Kept Tests

All remaining tests verify actual behavior:

  • CommonNotice.test.ts: Error handling, progress management, async wrappers
  • Frontmatter template filtering, deletion, and edit with command re-registration
  • Tag setting updates and edge case handling

Test Results

Test Suites: 7 passed, 8 total (1 unrelated failure in api/prompt.test.ts)
Tests:       66 passed, 67 total

Impact

  • Reduced test maintenance burden by removing ~264 lines of low-value tests
  • Improved test suite signal-to-noise ratio
  • Maintained coverage of critical business logic and regression scenarios

🤖 Generated with Claude Code

GoBeromsu and others added 2 commits December 28, 2025 20:31
## Test Structure Changes
- api/providers/unified.test.ts → api/UnifiedProvider.test.ts
- ui/components/commonButton.test.ts → ui/components/common/CommonButton.test.ts
- ui/components/commonNotice.test.ts → ui/components/common/CommonNotice.test.ts
- ui/containers/apiContainer.test.ts → ui/containers/Api.test.ts
- ui/containers/frontmatterContainer.test.ts → ui/containers/Frontmatter.test.ts
- ui/containers/tagContainer.test.ts → ui/containers/Tag.test.ts

## New Tests Added
- __tests__/api/prompt.test.ts (19 tests)
- __tests__/frontmatter/index.test.ts expanded (32 tests)
- __tests__/utils/index.test.ts (38 tests)

## Mock Improvements
- Added Obsidian API mocks: getFrontMatterInfo, parseFrontMatterStringArray, getAllTags
- Added MetadataCache and TFile classes for testing

Total: 134 tests across 10 test suites

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Remove tests that only verify:
- Mock method calls without actual logic validation
- Trivial data structure existence checks
- Simple rendering side effects (e.g., container.empty called)

Deleted files:
- CommonButton.test.ts: Only tested mock method calls, no actual UI logic
- Api.test.ts: Tested trivial data assignments and mock behavior

Modified files:
- Frontmatter.test.ts: Removed trivial "Basic Rendering" tests, kept critical regression tests for filtering and template management logic
- Tag.test.ts: Removed trivial "Basic Rendering" test, kept critical regression tests for tag setting management

Kept tests verify actual behavior:
- CommonNotice.test.ts: Tests actual error handling, progress management, and async wrappers
- Frontmatter template filtering (id=0), delete, and edit logic
- Tag setting update and error handling edge cases

Test results: 7/8 suites pass (1 unrelated failure in api/prompt.test.ts)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@GoBeromsu GoBeromsu closed this Dec 28, 2025
@GoBeromsu
GoBeromsu deleted the test/optimize-ui-tests branch December 28, 2025 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant