Skip to content

Commit 94f8f35

Browse files
committed
test: split init_spec.lua into smaller files
1 parent 0e2a867 commit 94f8f35

10 files changed

Lines changed: 2041 additions & 1970 deletions

docs/contributing.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -304,9 +304,10 @@ codex.setup({
304304
})
305305
```
306306

307-
See `tests/unit/init_spec.lua` for the canonical examples of all mock factories:
308-
`make_provider`, `make_session_store`, `make_logger`, `make_formatter`,
309-
`make_selection`, `make_fake_vim`, and the `setup_with_deps` helper.
307+
See `tests/unit/helpers/init_spec_helpers.lua` for the canonical examples of
308+
all mock factories: `make_provider`, `make_session_store`, `make_logger`,
309+
`make_formatter`, `make_selection`, `make_fake_vim`, and the
310+
`setup_with_deps` helper.
310311

311312
### Contract Tests
312313

@@ -372,8 +373,10 @@ When cutting a new release tag:
372373
concern; otherwise keep it in `init.lua`.
373374
2. **User command** -- Register the `:Codex*` command in
374375
`lua/codex/nvim/commands.lua`, delegating to the API function.
375-
3. **Unit tests** -- Add test cases in `tests/unit/init_spec.lua` covering the
376-
new API function (happy path, error path, auto-open behaviour).
376+
3. **Unit tests** -- Add test cases in the command-focused
377+
`tests/unit/init_*_spec.lua` files (happy path, error path, auto-open
378+
behaviour), and use `tests/unit/helpers/init_spec_helpers.lua` for shared
379+
mocks and setup helpers.
377380
4. **Command dispatch tests** -- If the command exercises a new code path beyond
378381
existing patterns, add targeted tests.
379382
5. **README update** -- Add the command to the Commands section and the Lua API

0 commit comments

Comments
 (0)