mirror of
https://github.com/banisterious/obsidian-custom-selected-word-count.git
synced 2026-07-22 05:49:07 +00:00
134 tests across six files lock the current behavior of the three count entry points and their support code, giving Phase 5's planned single-file split a load-bearing safety net. Files: - vitest.config.ts: node environment; resolve.extensions prefers .ts so imports resolve to main.ts source (not the main.js build artifact); alias redirects 'obsidian' to the test mock. - tests/mocks/obsidian.ts: minimal no-op stubs (App, Plugin, Modal, Setting, etc.) so main.ts's imports resolve in tests. - tests/fixtures/settings.ts: makeSettings(overrides) helper for spreading DEFAULT_SETTINGS with per-test overrides. - tests/counting/words.test.ts (37 tests): baseline, code/comment/link/ heading/words-and-phrases/extension/path exclusion modes, advanced regex, combination cases. - tests/counting/characters.test.ts (18 tests): all/no-spaces/letters-only modes plus the exclusion matrix. - tests/counting/sentences.test.ts (21 tests): baseline, abbreviation / decimal / URL / file-path / file-extension / ellipsis guards, and settings-driven exclusions. - tests/counting/text.test.ts (5 tests): countSelectedText aggregator. - tests/exclusions/overrides.test.ts (18 tests): the four override mechanisms (frontmatter array, string, "all" expansion, inline comment markers in both HTML and Obsidian styles) plus the disabledExclusions parameter. - tests/exclusions/processors.test.ts (35 tests): direct unit tests for the individual process* helpers. Three pre-existing quirks surfaced during test-writing and are locked in by 'LOCKED quirk:' tests so a later phase can decide whether to fix each: - Path-exclusion buffer is greedy (a detected path swallows trailing words to end of input). - Sentence-detection abbreviation guard never fires (the period is consumed by the split regex before the guard runs). - Sentence-detection file-extension guard discards entire sentences ending in name.ext rather than just the in-filename period. Details in docs/planning/audit-phase-4-tests.md § Findings. |
||
|---|---|---|
| .. | ||
| counting | ||
| exclusions | ||
| fixtures | ||
| mocks | ||