Skip to content

test: add tests for presets.ts bundle helper functions #60

@George-iam

Description

@George-iam

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.tsDecision, 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomerstestingTest improvements and coverage

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions