The presets module (src/presets.ts) provides helper functions that convert preset bundles into typed domain objects: bundlesToDecisions, bundlesToMemories, bundlesToDeployChecklists, bundlesToConfigDefaults, and applyPresetSafetyRules. These are pure functions that take bundle IDs and return structured data, making them easy to test. Currently there are no dedicated tests for these helpers.
Relevant files:
src/presets.ts — the module to test
src/types.ts — Decision, Memory, SafetyRules types
test/ — place the new test file here as presets.test.ts
Suggested test cases:
getPresetBundle returns correct bundle for known ID
getPresetBundle returns undefined for unknown ID
bundlesToDecisions generates sequential D-NNN IDs starting from given startId
bundlesToDecisions deduplicates by slug across multiple bundles
bundlesToMemories sets source to "preset" and sessionId to null
bundlesToDeployChecklists merges staging and production items from multiple bundles
applyPresetSafetyRules unions deny lists without duplicates
bundlesToConfigDefaults merges config from multiple bundles (later wins)
Acceptance criteria:
- New file
test/presets.test.ts with at least 10 tests
- All tests pass with
npm test
The presets module (
src/presets.ts) provides helper functions that convert preset bundles into typed domain objects:bundlesToDecisions,bundlesToMemories,bundlesToDeployChecklists,bundlesToConfigDefaults, andapplyPresetSafetyRules. These are pure functions that take bundle IDs and return structured data, making them easy to test. Currently there are no dedicated tests for these helpers.Relevant files:
src/presets.ts— the module to testsrc/types.ts—Decision,Memory,SafetyRulestypestest/— place the new test file here aspresets.test.tsSuggested test cases:
getPresetBundlereturns correct bundle for known IDgetPresetBundlereturns undefined for unknown IDbundlesToDecisionsgenerates sequential D-NNN IDs starting from given startIdbundlesToDecisionsdeduplicates by slug across multiple bundlesbundlesToMemoriessets source to "preset" and sessionId to nullbundlesToDeployChecklistsmerges staging and production items from multiple bundlesapplyPresetSafetyRulesunions deny lists without duplicatesbundlesToConfigDefaultsmerges config from multiple bundles (later wins)Acceptance criteria:
test/presets.test.tswith at least 10 testsnpm test