summaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)Author
2025-11-08test: core: enhance ERT tests for pure functionsCraig Jennings
- Enhanced test-wttrin-additional-url-params with clearer test organization - Enhanced test-wttrin--build-url with comprehensive boundary and error cases - Added tests for Unicode, special characters, GPS coordinates, domains - Fixed domain name test to check for URL-encoded @ symbol (%40) - Enhanced test-wttrin--make-cache-key with extensive boundary tests - Critical test: same location with different units produces different keys - Added tests for special chars, Unicode, empty strings, pipe characters All 29 tests for these three pure functions now pass (6 + 12 + 11) Combined with wttrin--fetch-url tests: 38 total tests passing
2025-11-08refactor: fetch: extract duplicate URL fetching logic into wttrin--fetch-urlCraig Jennings
- Created wttrin--fetch-url helper to eliminate code duplication - Refactored wttrin-fetch-raw-string to use helper (27 lines -> 3 lines) - Refactored wttrin--mode-line-fetch-weather to use helper (~30 lines -> ~10 lines) - Added comprehensive ERT test suite with 9 tests covering normal, boundary, and error cases - All tests passing This refactoring provides a single point of truth for async URL fetching, making the code more maintainable and reducing duplication by ~40 lines.
2025-11-04fix(wttrin): Fix ANSI color rendering on fresh Emacs launchCraig Jennings
Critical bug fix: On fresh Emacs launch, weather displayed with only double quotes colored blue, all other text white. Pressing 'g' to refresh brought colors back. Root cause: wttrin-mode (derived mode) calls kill-all-local-variables internally. The code was setting xterm-color--state buffer-local BEFORE calling wttrin-mode, so the state was immediately wiped out. On refresh, the mode was already active (no-op), so the state survived. Fix: Call wttrin-mode FIRST, then set buffer-local variables after. This ensures kill-all-local-variables runs before we set any state. Changes: - Reorder initialization in wttrin--display-weather (wttrin.el:277-285) - Add regression tests for mode initialization order (2 new tests) Test results: 65 tests, all passing
2025-11-04feat(emacs): Add asynchronous weather fetching to wttrinCraig Jennings
Introduce asynchronous data fetching to the wttrin.el Emacs package. This enhancement avoids blocking Emacs during data retrieval by using `url-retrieve` for async calls. The behavior is controlled via a new customizable variable `wttrin-use-async`. Tests have been added for the new async behavior to ensure proper functionality.feat:makefile): Add package initialization for Emacs batch Enhance Makefile with package support by loading and initializing MELPA archive before validating and compiling, ensuring required packages are available during these operations. feat(tests): Add unit tests for `wttrin--display-weather` Introduce comprehensive tests for `wttrin--display-weather` function to validate buffer creation, content, keybindings, and error handling.
2025-11-04Add comprehensive ERT test suite and fix critical bugsCraig Jennings
Session 1: Testing infrastructure and initial test coverage Bug fixes in wttrin.el: - Fix wttrin-additional-url-params to handle nil unit system - Remove incorrect callback parameter to url-retrieve-synchronously - Add nil buffer check for network failures - Strip HTTP headers before decoding response - Kill buffer after fetch to prevent memory leaks - Fix double concatenation of URL params in cache function - Add proper URL encoding via new wttrin--build-url function Refactoring: - Extract wttrin--build-url as pure, testable function - Separate URL building logic from network I/O Test infrastructure (33 tests, 100% passing): - tests/testutil-wttrin.el: Shared test utilities - tests/test-wttrin-additional-url-params.el: 7 tests - tests/test-wttrin--make-cache-key.el: 9 tests - tests/test-wttrin--build-url.el: 10 tests - tests/test-wttrin--cleanup-cache-if-needed.el: 7 tests Documentation: - docs/testing-plan.org: Comprehensive testing roadmap - docs/bugs.org: Bug analysis from code review - docs/NOTES.org: Session tracking and guidelines - docs/session-1-summary.org: Detailed session summary Next session: Cache workflow tests, parsing logic extraction, integration tests 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>