Skip to content

Cover project with tests#1

Merged
petros merged 1 commit intomainfrom
test
Dec 3, 2025
Merged

Cover project with tests#1
petros merged 1 commit intomainfrom
test

Conversation

@petros
Copy link
Copy Markdown
Owner

@petros petros commented Dec 3, 2025

Test Implementation Summary

Tests Added: 73 total

Module Tests Coverage
data.rs 40 Session, Label, Store + edge cases
storage.rs 13 Load, save, roundtrip, paths
commands.rs 20 add, list, remove, describe, config, resume

By Category:

  1. Data Model Tests (26 unit + 14 edge cases)
  • Session creation, serialization, description handling
  • Label creation, add/remove sessions, latest_session
  • Store CRUD operations
  • Serialization roundtrips
  1. Storage Tests (13)
  • Load: missing file, empty file, whitespace, valid JSON, corrupt JSON
  • Save: file creation, valid JSON output, overwrite
  • Roundtrip: empty store, with data
  • Path handling
  1. Command Integration Tests (20)
  • add: new label, append, description, current directory
  • list: empty, all labels, specific label, nonexistent
  • remove: entire label, specific session, error cases
  • describe: set, update, clear, error cases
  • resume: error conditions (can't test external command execution)
  • config: basic functionality
  1. Edge Cases (14)
  • Empty session IDs and label names
  • Unicode (Japanese, Russian, emoji) in all fields
  • Very long session histories (1000 sessions)
  • Many labels (100 with 10 sessions each)
  • Special characters in descriptions and labels
  • Duplicate session IDs handling
  • Whitespace preservation

Test Implementation Summary

Tests Added: 73 total

| Module      | Tests | Coverage                                    |
|-------------|-------|---------------------------------------------|
| data.rs     | 40    | Session, Label, Store + edge cases          |
| storage.rs  | 13    | Load, save, roundtrip, paths                |
| commands.rs | 20    | add, list, remove, describe, config, resume |

By Category:

1. Data Model Tests (26 unit + 14 edge cases)

  - Session creation, serialization, description handling
  - Label creation, add/remove sessions, latest_session
  - Store CRUD operations
  - Serialization roundtrips

2. Storage Tests (13)

  - Load: missing file, empty file, whitespace, valid JSON, corrupt JSON
  - Save: file creation, valid JSON output, overwrite
  - Roundtrip: empty store, with data
  - Path handling

3. Command Integration Tests (20)

  - add: new label, append, description, current directory
  - list: empty, all labels, specific label, nonexistent
  - remove: entire label, specific session, error cases
  - describe: set, update, clear, error cases
  - resume: error conditions (can't test external command execution)
  - config: basic functionality

4. Edge Cases (14)

  - Empty session IDs and label names
  - Unicode (Japanese, Russian, emoji) in all fields
  - Very long session histories (1000 sessions)
  - Many labels (100 with 10 sessions each)
  - Special characters in descriptions and labels
  - Duplicate session IDs handling
  - Whitespace preservation
@petros petros self-assigned this Dec 3, 2025
@petros petros added the enhancement New feature or request label Dec 3, 2025
@petros petros merged commit b2bc794 into main Dec 3, 2025
4 checks passed
@petros petros deleted the test branch December 3, 2025 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant