Skip to content

test: add unit tests for state lib - #250

Open
TerminalGravity wants to merge 1 commit into
mainfrom
tests/add-state-lib-coverage
Open

test: add unit tests for state lib#250
TerminalGravity wants to merge 1 commit into
mainfrom
tests/add-state-lib-coverage

Conversation

@TerminalGravity

Copy link
Copy Markdown
Collaborator

Adds 11 unit tests for src/lib/state.ts covering loadState, saveState, appendLog, readLog, and now.

Uses temp directories with vi.doMock for proper module isolation — no filesystem leaks between tests.

All 54 tests passing (6 suites).

…readLog, now)

Covers:
- loadState: missing file, valid JSON, corrupt JSON
- saveState: creates dir, writes file, overwrites
- appendLog/readLog: append + read, missing file, lastN, corrupt lines, empty file
- now: valid ISO string
- Uses temp dirs with vi.doMock for proper module isolation

11 new tests, all passing.

@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.

State lib coverage is a good gap to fill. Looks clean.

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