Parent
Part of #739
Context
The command DSL (command() function) currently has no direct unit tests. The decorator tests indirectly test it, but we need dedicated tests for:
-
DSL function tests (packages/core/test/dsl/command.test.ts):
- Registration works correctly and metadata is stored in config
- Duplicate name detection throws error
- Default values (before defaults to [], methods defaults to [])
- All three authorize option variants ('all', roles array, custom function)
- Returned metadata matches what was registered
- Properties are properly passed through
- Handler function is stored correctly
-
DSL integration tests:
- A command defined via
command() can be dispatched through MagekCommandDispatcher
- Authorization works for DSL-defined commands
- Before hooks work for DSL-defined commands
-
Interoperability tests:
- DSL commands and decorator commands can coexist in the same config
- Both types are dispatched correctly
-
Decorator regression tests:
- Ensure the existing decorator tests are comprehensive enough to catch regressions
- The decorator's class instantiation adapter (Object.assign + handle) works correctly
Acceptance Criteria
Parent
Part of #739
Context
The command DSL (
command()function) currently has no direct unit tests. The decorator tests indirectly test it, but we need dedicated tests for:DSL function tests (
packages/core/test/dsl/command.test.ts):DSL integration tests:
command()can be dispatched throughMagekCommandDispatcherInteroperability tests:
Decorator regression tests:
Acceptance Criteria
packages/core/test/dsl/command.test.tscreated with comprehensive tests