Skip to content

Conversation

@dpuglielli
Copy link
Collaborator

Summary

  • Refactor memento tests to conform to test guidelines (DI pattern, no process.chdir, table-driven tests)
  • Add DI support (cwd parameter) to session.js, create-session.js, get-session.js
  • Create shared test-utils/test-helpers.js with setupGitRepo, createTempDir, cleanupTempDir
  • Eliminate unreachable fallback branches by reordering logic in verify-session.js
  • Bump version to 0.1.20

Test plan

  • All 184 tests passing
  • Branch coverage 93.1% (exceeds 92% threshold)
  • No process.chdir usage in tests
  • Table-driven tests for parseBranchName

- Add DI support (cwd parameter) to session.js, create-session.js, get-session.js
- Add silent option to prevent process.exit() in tests
- Convert parseBranchName tests to table-driven format using it.each()
- Create shared test-utils/test-helpers.js (setupGitRepo, createTempDir, cleanupTempDir)
- Remove all process.chdir usage from tests
- Add edge case tests for uncovered branches
- Reorder verify-session.js logic to eliminate unreachable fallbacks
- Branch coverage: 93.1% (exceeds 92% threshold)
- 184 tests passing
- Replace real git commands with jest.mock for child_process
- Mock session module in create-session and get-session tests
- Remove test-utils/test-helpers.js that used real git
- Suppress console output in tests with jest.spyOn
- Tests are now deterministic and platform-independent
- Add full fs mocking to session.test.js (existsSync, mkdirSync, readFileSync)
- Add default parameter branch tests for 100% coverage in session.js
- Add ZERO ATTRIBUTION blocking rules to mantra/behavior.yml and onus/git.yml
- Bump mantra to 0.1.9 and onus to 0.1.7
@dpuglielli dpuglielli marked this pull request as draft December 20, 2025 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants