[go: up one dir, main page]

Add test suite for command modules

Overview

The commands/ directory contains 8 command modules with no test coverage. Each module registers user commands and needs testing.

Modules to Test

1. delete.lua

  • Test: registers :ZkDelete command
  • Test: command has correct description
  • Test: command supports bang (!)
  • Test: calls remove.remove() with correct args

2. delete_pick.lua

  • Test: registers :ZkDeletePick command
  • Test: command has correct description
  • Test: command supports bang (!)
  • Test: calls remove.remove_pick() with correct args

3. snippet.lua

  • Test: registers :ZkSnippet command
  • Test: command has correct description
  • Test: calls snippet.insert_snippet()

4. pick_template.lua

  • Test: registers :ZkPickTemplate command
  • Test: command has correct description
  • Test: calls template.new_from_template()

5. new_selection_with_template.lua

  • Test: registers :ZkNewFromTitle command
  • Test: registers :ZkNewFromContent command
  • Test: commands have correct descriptions
  • Test: commands support range mode
  • Test: :ZkNewFromTitle gets visual selection as title
  • Test: :ZkNewFromTitle shows template picker
  • Test: :ZkNewFromContent gets visual selection as content
  • Test: :ZkNewFromContent prompts for title
  • Test: handles no visual selection
  • Test: handles zk-nvim not available
  • Test: handles no templates found

6. present.lua

  • Test: registers :ZkPresent command
  • Test: command has correct description
  • Test: calls misc.slides()

7. update.lua

  • Test: registers :ZkUpdate command
  • Test: command has correct description
  • Test: executes zk update
  • Test: shows output in quickfix
  • Test: shows notifications

8. zk_integration.lua

  • Test: only registers when zk-nvim available
  • Test: registers :ZkOrphans with correct filter
  • Test: registers :ZkRecents with correct filter
  • Test: registers :ZkPinned with correct filter
  • Test: registers :ZkHub with correct filter
  • Test: registers :ZkLast with correct filter
  • Test: commands call zk.edit with correct options

Integration Tests

  • Test: commands are registered when enabled in config
  • Test: commands are not registered when disabled
  • Test: command conflicts are handled correctly
  • Test: deprecation warnings work for old command names

Test File Location

tests/zk-extras/commands_spec.lua

Priority

Medium - Commands are thin wrappers but need verification

Notes

Focus on:

  1. Command registration
  2. Argument passing
  3. Error handling
  4. Config respect