summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* fix: skip declined events in tooltip, modeline, and notificationsCraig Jennings2026-05-051-0/+156
| | | | | | | | | | | | | | | | | | org-gcal writes `:STATUS: declined' on calendar entries the user has declined, and chime was happily showing them in the tooltip, modeline, and notification stream — which defeats the whole point of declining a meeting. I added `chime-declined-events-predicate', mirroring the shape of `chime-done-keywords-predicate', and put it on the default `chime-predicate-blacklist'. The match is on the literal lowercase value because that's what real org-gcal exports use; uppercase or other values pass through. Users who want declined events back can pop the predicate off the blacklist. Tests cover all four STATUS values seen in real org-gcal data (accepted, declined, needs-action, tentative), plus the no-property, empty-property, todo-keyword-still-attached, gibberish-value, case-sensitivity, and default-blacklist-membership cases.
* test: tag integration suite :slow and unstick test-allCraig Jennings2026-05-054-1/+16
| | | | | | | | | | | | | | | I tagged the 15 end-to-end tests across `test-integration-chime-mode.el`, `test-integration-recurring-events-tooltip.el`, and `test-integration-startup.el` with `:tags '(:slow)`. The default `make test` now runs only the 652 fast unit tests; `make test-all` runs the full 667. While verifying, I hit a pre-existing bug in `tests/Makefile` where `test-all`'s `--eval '(ert-run-tests-batch-and-exit)'` came back from eask's argv passthrough with its quotes stripped, which broke shell parsing. Passing the explicit `t` selector dodges whatever eask does to no-arg single-quoted forms. The bug only mattered once integration tests were `:slow` — before that, `test-all` overlapped fully with `test-unit` plus `test-integration`, so nothing actually depended on it working.
* build: add eask manifest and setup/compile/coverage targetsCraig Jennings2026-05-052-88/+152
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I switched the test runner from `~/.emacs.d/elpa`-grep to eask. With this, `make setup` installs every dep into a project-local `.eask/`, so test runs don't depend on whatever's in my global elpa. It also lets us catch missing Package-Requires entries before MELPA submission. New targets: - `make setup` — runs `eask install-deps --dev` - `make compile` — byte-compiles chime.el and surfaces warnings that checkdoc and elisp-lint don't catch - `make coverage` — runs the unit suite under undercover and writes a simplecov JSON to `.coverage/simplecov.json` - `make test-all` — runs every test, including `:slow` tagged - `-include makefile-local` in both Makefiles, for per-machine knobs I added `ERT_FAST_SELECTOR` so `make test`, `test-unit`, `test-integration`, and `test-file` exclude tests tagged `:slow`. When we tag end-to-end integration tests as `:slow`, they'll stay out of the fast feedback loop until someone explicitly asks for them via `make test-all`. Eask treats CWD as its workspace. So all eask invocations now run from project root, with `(cd "tests/")' as the first `--eval' to restore Emacs's default-directory. That preserves the relative loads the existing test files and test-bootstrap.el rely on, without touching either. I updated `.gitignore` for `.eask/`, `.coverage/`, and the optional `makefile-local` files.
* refactor: move 12 internal helpers from chime- to chime-- prefixCraig Jennings2026-04-227-131/+131
| | | | | | | | | | Before MELPA submission, tighten the public API surface. Single-dash chime-foo is the convention for user-facing commands and predicates that external code can bind. Anything that is not meant to be bound externally should use the double-dash chime--foo prefix so byte-compile warnings, docstrings, and MELPA package inspection all point in the same direction. Twelve helpers in chime.el had single-dash names but no user-facing role. They are not mentioned in README, they carry no interactive declaration, and their docstrings do not promise a behavior contract. Rename them: chime-get-minutes-into-day, chime-get-hours-minutes-from-time, chime-set-hours-minutes-for-time, chime-current-time-matches-time-of-day-string, chime-current-time-is-day-wide-time, chime-day-wide-notifications, chime-display-as-day-wide-event, chime-event-has-any-day-wide-timestamp, chime-event-within-advance-notice-window, chime-event-has-any-passed-time, chime-event-is-today, chime-environment-regex. The public API surface is now intentional. It covers chime-mode, chime-validate-configuration, chime-refresh-modeline, chime-done-keywords-predicate, and the chime-debug-* interactive commands in chime-debug.el. Breaking change. No alias shims because there are no downstream users yet.
* test: add unit tests for chime--day-label-for-event-timeCraig Jennings2026-04-221-0/+71
| | | | | | | | | | Seven pure-function tests appended to the group-events-by-day file, covering Normal and Boundary cases. Normal: event on the same calendar day as NOW returns "Today, ...". Event on the same calendar day as TOMORROW returns "Tomorrow, ...". Event three days out returns a weekday label and is neither Today nor Tomorrow. Boundary: event at 00:00 on the NOW calendar day is Today. Event at 00:00 on the TOMORROW calendar day is Tomorrow. Event two calendar days out is not Tomorrow, gets a weekday label. Event on the previous calendar day is neither Today nor Tomorrow. Since NOW and TOMORROW are function arguments, the tests use encode-time to build stable calendar values and skip the clock-mocking dance.
* test: pin group-events-by-day clock and add midnight edge casesCraig Jennings2026-04-221-94/+123
| | | | | | | | | | The Normal and Boundary tests built events as fixed-minute offsets from real current-time. On late-night runs the +60 minute event in single-day crossed midnight and the test failed because events 1-2 landed "Today" while event 3 landed "Tomorrow". The intent of these Normal tests is routine grouping, not midnight behavior, so they should be deterministic. Pin the clock with with-test-time using the established let-bind pattern. with-test-time re-evaluates BASE-TIME inside the mocked current-time lambda, so passing test-time-today-at directly would recurse, because the helper itself calls current-time. Add two new Boundary tests that explicitly exercise the day-crossing logic at 23:50. One event at +5 minutes stays in Today and one at +20 minutes crosses into Tomorrow. These are the first tests in the file that actually target midnight behavior. Drop stale "REFACTORED: Uses dynamic timestamps" annotations from docstrings since the behavior is documented at the file level.
* test: add unit tests for async result helpersCraig Jennings2026-04-221-0/+147
| | | | | | | | Eight tests in a new file covering Normal and Boundary cases for both new helpers. chime--record-async-failure increments the consecutive-failure counter, sets chime-modeline-string to the standard error tooltip, triggers the threshold warning when the counter hits chime-max-consecutive-failures, and leaves chime-modeline-string alone when chime-modeline-no-events-text is nil. chime--handle-async-success resets the counter from non-zero to zero, invokes the callback with the events list, works with an empty events list, and is a no-op on the counter when it already starts at zero.
* test: add unit tests for chime--render-modeline-stringCraig Jennings2026-04-211-0/+52
| | | | | | | | | | Five tests covering Normal and Boundary cases. Normal: SOONEST branch applies chime-modeline-format to the event-text. Normal: no SOONEST plus UPCOMING binds mouse-1 (open calendar) and mouse-3 (jump to event). Normal: no SOONEST and no UPCOMING binds only mouse-1, and the tooltip is the no-events message. Boundary: returns nil when no SOONEST and chime-modeline-no-events-text is nil. Boundary: SOONEST branch renders regardless of whether chime-modeline-no-events-text is set. The orchestrator chime--update-modeline already exercises these paths via test-chime-update-modeline.el. These direct unit tests give the helper its own coverage.
* Consolidate Makefiles and update TESTING.orgCraig Jennings2026-04-041-32/+43
| | | | | | Root Makefile now delegates to tests/Makefile. Fixed stale UNIT_TESTS/INTEGRATION_TESTS definitions, added test-name target, switched to per-file test execution for better isolation.
* Add tests for chime-environment-regexCraig Jennings2026-04-041-0/+62
| | | | | Verify the regex matches all default variable names, picks up additional user-configured regexes, and handles empty additional list.
* Remove unused chime--today functionCraig Jennings2026-04-041-84/+0
| | | | Defined and tested but never called from any production code.
* Bundle multiple day-wide events into a single notificationCraig Jennings2026-04-041-0/+57
| | | | | | | | | | When all-day event alert times trigger, multiple events (overdue tasks, birthdays, holidays) previously fired individual notifications — one sound and one popup each. With 8-10 events this was overwhelming. Now multiple day-wide events are bundled into a single notification with all messages joined by newlines. Single events still notify normally without bundling.
* Restructure README and address review commentsCraig Jennings2026-04-041-2/+1
| | | | | | | | | | | | | | - Remove About section (merged into intro) - Rename Credits to History, fold Migration under it - Fold Manual Check and Known Limitations under Usage - Fold Full Example Configuration under Configuration - Add straight.el and quelpa install methods - Move requirements into Installation with auto-deps note - Add notification daemon check to troubleshooting - Add Development subsection with clone/lint/issues info - Add LICENSE file (GPL-3.0) - Update nav bar to match new structure - Fix startup integration test for new modeline error state
* Show modeline icon immediately on chime-mode enableCraig Jennings2026-04-041-0/+45
| | | | | | | | | Previously chime-modeline-string was nil until the first async check completed (~10-15 seconds after startup). Now the icon appears instantly with a "waiting for first event check" tooltip. On validation or async failure, the icon stays visible and the tooltip updates to show the error state instead of going blank.
* Remove dead code and reduce default tooltip lookahead to 1 weekCraig Jennings2026-04-041-22/+0
| | | | | | | | | | | Remove chime--agenda-buffer-name (unused variable) and chime--extract-birthday-year (superseded by chime--parse-birthday). Reduce chime-tooltip-lookahead-hours from 8760 (1 year) to 168 (1 week). The 1-year default caused org-agenda-list to scan a 365-day span every check cycle, which is slow for large org collections. The tooltip only shows 5 events, so a week is sufficient for most users.
* Nil chime--timer after cancellation in chime--stopCraig Jennings2026-04-041-0/+11
| | | | | The timer variable was left pointing at a cancelled timer object. Now set to nil so state accurately reflects no active timer.
* Fix file headers: correct copyright years, add missing headerCraig Jennings2026-04-0412-11/+28
| | | | | New files created in 2026 should have Copyright (C) 2026, not 2024-2026. Add standard copyright/license header to test-bootstrap.el.
* Extract test boilerplate into shared test-bootstrap.elCraig Jennings2026-04-0451-656/+96
| | | | | | | | | | All 50 test files that load chime.el repeated the same 8-line initialization block (package-initialize, ert, dash, alert, async, org-agenda, chime load). Replace with a single require of test-bootstrap.el. Also fix test-make-upcoming-item name collision between test-chime-make-tooltip.el and test-chime--deduplicate-events-by-title.el.
* Consolidate birthday utilities into convert-org-contacts-birthdaysCraig Jennings2026-04-041-153/+4
| | | | | | | | | | chime-org-contacts.el duplicated parse, format, and insert-after-drawer functions from convert-org-contacts-birthdays.el. Remove the duplicates and have chime-org-contacts require the convert module instead. Removes ~35 lines of duplicated code. The finalize function now delegates to chime--insert-birthday-timestamp-after-drawer with condition-case for graceful handling of invalid birthday formats during capture.
* Add integration test for chime-mode deactivation cleanupCraig Jennings2026-04-041-0/+10
| | | | | Verifies disabling chime-mode removes chime-modeline-string from global-mode-string and sets it to nil.
* Add integration test for chime-mode modeline registrationCraig Jennings2026-04-041-0/+61
| | | | | Verifies enabling chime-mode adds chime-modeline-string to global-mode-string so events appear in the modeline.
* Add 94 tests across 10 new test files and fix 2 bugsCraig Jennings2026-04-0410-0/+1545
| | | | | | | | | | | | New test coverage for previously untested functions: - filter-day-wide-events, time utilities, day-wide time matching - make-tooltip, event-is-today, get-tags, done-keywords-predicate - extract-title, propertize-modeline-string, warn-persistent-failures - log-silently Bug fixes discovered by new tests: - Fix pluralization in no-events tooltip ("1 hours" -> "1 hour", etc.) - Fix chime--get-tags returning ("") instead of nil for untagged headings
* Add test config macros and migrate startup tests to use themCraig Jennings2026-02-262-155/+186
| | | | | | Add with-chime-config and with-org-event-file macros to testutil-events.el, replacing the manual defvar/save/restore pattern with let-bindings that auto-restore on exit. Migrate test-integration-startup.el as first adopter.
* Improve org-agenda-files validation to distinguish files from directoriesCraig Jennings2026-02-231-4/+4
|
* Fix flaky validation failure test by resetting shared stateCraig Jennings2026-02-231-0/+6
| | | | | | The test checks that chime-modeline-string and chime--upcoming-events are nil after early return, but previous tests could leave them set. Reset these and chime--validation-retry-count at test start.
* Update copyright years to 2026 across all source filesCraig Jennings2026-02-1737-37/+37
| | | | | Updated 41 files: chime.el, chime-debug.el, chime-org-contacts.el, convert-org-contacts-birthdays.el, and all test/utility files.
* Add notification boundary tests for time comparison fixCraig Jennings2026-02-171-0/+361
| | | | | 12 ERT tests covering exact interval matching, cross-month/year boundaries, midnight crossing, multiple intervals, and escalating notifications.
* changed repositoriesCraig Jennings2025-11-1845-0/+13475