Skip to content

Add missing tests for core modules #40

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jul 6, 2025
Merged

Add missing tests for core modules #40

merged 7 commits into from
Jul 6, 2025

Conversation

lambdalisue
Copy link
Collaborator

Summary

  • Add comprehensive tests for 5 core modules that were missing test coverage
  • Use DenopsStub for mocking when possible, test() function for integration tests
  • Follow BDD style with describe/it blocks
  • All tests pass linting, type checking, and formatting

Test Files Added

  • error_test.ts - Tests for ExpectedError and withHandleError functionality
  • custom_test.ts - Tests for configuration loading and management
  • predicate_test.ts - Tests for all type predicate functions
  • polyfill_test.ts - Tests for DisposableStack polyfills
  • submatch_test.ts - Tests for submatch dispatcher functionality

Test Plan

  • All new tests pass (deno task test)
  • Code passes linting (deno lint)
  • Code passes type checking (deno task check)
  • Code is properly formatted (deno fmt)
  • Tests use appropriate mocking strategies
  • Integration tests use real Denops instances where needed

🤖 Generated with Claude Code

lambdalisue and others added 7 commits July 6, 2025 22:20
Add comprehensive tests for error.ts including:
- ExpectedError class constructor with and without source
- handleError function for ExpectedError, AssertError, and unknown errors
- withHandleError wrapper for sync and async functions

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

Co-Authored-By: Claude <[email protected]>
Add tests for all predicate functions including:
- isStringArray, isAbortSignal
- isTheme, isCoordinator, isCurator
- isSource, isMatcher, isSorter
- isRenderer, isPreviewer, isAction
- isSetting, isPickerParams, isOptions
- isIncrementalMatcher

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

Co-Authored-By: Claude <[email protected]>
Add tests verifying that DisposableStack and AsyncDisposableStack
are properly polyfilled in globalThis and their basic functionality works.

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

Co-Authored-By: Claude <[email protected]>
Add integration tests for submatch functionality:
- Dispatcher registration
- Invalid context/params rejection
- Valid submatch call processing
- Optional parameter handling
- Return value propagation

Tests use real Denops instances to verify integration behavior.

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

Co-Authored-By: Claude <[email protected]>
Add comprehensive tests for custom configuration:
- Unit tests for getSetting, getActionPickerParams, getPickerParams, listPickerNames
- Integration tests for loadUserCustom with real Denops instances
- Tests for default custom loading, user custom loading, reload option
- Validation tests for picker and action names
- Verbose option handling tests

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

Co-Authored-By: Claude <[email protected]>
Remove async keyword from dispatch mock functions that don't use await.
Use Promise.resolve() to maintain type compatibility.

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

Co-Authored-By: Claude <[email protected]>
The integration tests in custom_test.ts create temporary files with
cache-busting fragments that cause coverage generation to fail when
the temporary files are cleaned up but still referenced in coverage.

This fix excludes the integration test from coverage while preserving
all test functionality.

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

Co-Authored-By: Claude <[email protected]>
Copy link

codecov bot commented Jul 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.45%. Comparing base (e892695) to head (14fe201).
Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #40      +/-   ##
==========================================
+ Coverage   82.14%   83.45%   +1.31%     
==========================================
  Files          27       31       +4     
  Lines        1798     1977     +179     
  Branches      185      200      +15     
==========================================
+ Hits         1477     1650     +173     
- Misses        318      324       +6     
  Partials        3        3              

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@lambdalisue lambdalisue merged commit 5eb4a68 into main Jul 6, 2025
6 checks passed
@lambdalisue lambdalisue deleted the improve-tests branch July 6, 2025 13:58
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