refactor(tests): group test files by feature, drop phase/cluster naming
Restructures the integration test layout so each file is named after
what it covers, not the implementation phase it landed in.
nuwiki-core (renames only):
vimwiki_lexer → lexer
vimwiki_parser → parser
vimwiki_tags → tags
vimwiki_table_alignment → table_alignment
diary_period → diary
list_continuation → lists
transclusion_attrs → transclusion
+ table colspan/rowspan tests moved here from parity_cluster_1
nuwiki-lsp (renames + merges + one split):
cluster_a_list_rewriters → commands_lists
cluster_b_table_rewriters → commands_tables
cluster_c_link_helpers +
phase19_followlink_creates → commands_links
phase13_rename_commands → commands_files
phase17_colorize → commands_colorize
phase17_html_export → html_export
phase15_link_health → link_health
phase18_multi_wiki → multi_wiki
phase19_folding → folding
nav → navigation
lsp_helpers → helpers
phase16_diary +
diary_frequency → diary
phase11_plumbing +
parity_cluster_1 (config) → index_and_config
tags_index_and_lsp +
phase17_backfill → commands_tags
phase14_edit_commands → split into
commands_checkboxes,
commands_headings,
commands_tasks
Net: 30 → 28 integration-test files. 456 → 455 tests (the one
removed test was a dummy `paragraph_render_is_unchanged` whose only
purpose was to keep a `ParagraphNode` import alive in
parity_cluster_1; the import is exercised elsewhere now).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
//! Task navigation (`nuwiki.list.nextTask`) plus a smoke test that the
|
||||
//! `COMMANDS` registry advertises every list/heading/file handler the
|
||||
//! editor surface relies on.
|
||||
|
||||
use nuwiki_core::syntax::vimwiki::VimwikiSyntax;
|
||||
use nuwiki_core::syntax::SyntaxPlugin;
|
||||
use nuwiki_lsp::commands::ops;
|
||||
use tower_lsp::lsp_types::Url;
|
||||
|
||||
fn parse(src: &str) -> nuwiki_core::ast::DocumentNode {
|
||||
VimwikiSyntax::new().parse(src)
|
||||
}
|
||||
|
||||
fn dummy_uri() -> Url {
|
||||
Url::parse("file:///tmp/note.wiki").unwrap()
|
||||
}
|
||||
|
||||
// ===== next_task =====
|
||||
|
||||
#[test]
|
||||
fn next_task_returns_first_unfinished() {
|
||||
let src = "- [X] done\n- [ ] todo\n- [ ] later\n";
|
||||
let doc = parse(src);
|
||||
let loc = ops::next_task(&doc, &dummy_uri(), src, 0, 0, true).expect("found a task");
|
||||
// Should be line 1 (the first [ ]).
|
||||
assert_eq!(loc.range.start.line, 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn next_task_wraps_around_when_no_task_after_cursor() {
|
||||
// Only task is on line 0; cursor on line 2 → wraps back.
|
||||
let src = "- [ ] todo\n- [X] done\n- [X] also done\n";
|
||||
let doc = parse(src);
|
||||
let loc = ops::next_task(&doc, &dummy_uri(), src, 2, 0, true).expect("found");
|
||||
assert_eq!(loc.range.start.line, 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn next_task_returns_none_when_no_open_tasks() {
|
||||
let src = "- [X] a\n- [X] b\n";
|
||||
let doc = parse(src);
|
||||
let loc = ops::next_task(&doc, &dummy_uri(), src, 0, 0, true);
|
||||
assert!(loc.is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn next_task_only_counts_items_with_checkboxes() {
|
||||
// Plain items without a `[…]` are ignored — they're not tasks.
|
||||
let src = "- plain\n- [ ] real task\n";
|
||||
let doc = parse(src);
|
||||
let loc = ops::next_task(&doc, &dummy_uri(), src, 0, 0, true).expect("found");
|
||||
assert_eq!(loc.range.start.line, 1);
|
||||
}
|
||||
|
||||
// ===== smoke: COMMANDS list matches registered handlers =====
|
||||
|
||||
#[test]
|
||||
fn commands_list_is_complete() {
|
||||
let names: Vec<&str> = nuwiki_lsp::commands::COMMANDS.to_vec();
|
||||
for name in [
|
||||
"nuwiki.file.delete",
|
||||
"nuwiki.list.toggleCheckbox",
|
||||
"nuwiki.list.cycleCheckbox",
|
||||
"nuwiki.list.rejectCheckbox",
|
||||
"nuwiki.list.nextTask",
|
||||
"nuwiki.heading.addLevel",
|
||||
"nuwiki.heading.removeLevel",
|
||||
] {
|
||||
assert!(names.contains(&name), "missing: {name}");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user