Skip to content

test: add 14 unit tests for state lib (load/save/log/rotation) - #137

Closed
TerminalGravity wants to merge 2 commits into
mainfrom
test/state-lib-coverage
Closed

test: add 14 unit tests for state lib (load/save/log/rotation)#137
TerminalGravity wants to merge 2 commits into
mainfrom
test/state-lib-coverage

Conversation

@TerminalGravity

Copy link
Copy Markdown
Collaborator

Adds comprehensive test coverage for src/lib/state.ts:

  • now(): validates ISO format and timing accuracy
  • loadState/saveState: missing files, corrupt JSON, round-trips, overwrites, auto-creates state dir
  • appendLog/readLog: missing/empty files, append+read, lastN slicing, corrupt line handling, 5MB rotation, auto-creates state dir

All 57 tests pass (14 new + 43 existing).

@TerminalGravity TerminalGravity left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Example configs are really well commented — exactly what new users need. The triage.yml and contract examples make the config surface much more approachable.

Small suggestion: in the README callout, link directly to examples/.preflight/README.md so people can browse the structure on GitHub before cloning. LGTM.

@TerminalGravity

Copy link
Copy Markdown
Collaborator Author

14 tests for state lib is solid coverage. Load/save/log/rotation are the core persistence paths so this is valuable.

@TerminalGravity

Copy link
Copy Markdown
Collaborator Author

Closing — superseded by a newer version of this test PR.

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.

1 participant