Skip to content

Tests: add unit tests for sessions/session-label.ts#11387

Closed
WeatherPal-AI wants to merge 1 commit intoopenclaw:mainfrom
WeatherPal-AI:tests/session-label
Closed

Tests: add unit tests for sessions/session-label.ts#11387
WeatherPal-AI wants to merge 1 commit intoopenclaw:mainfrom
WeatherPal-AI:tests/session-label

Conversation

@WeatherPal-AI
Copy link

@WeatherPal-AI WeatherPal-AI commented Feb 7, 2026

Summary

Add 13 tests for the session label parsing module:

  • Valid labels, whitespace trimming, special and unicode characters
  • Max length boundary (exact limit and exceeding)
  • Rejection of empty, whitespace-only, and non-string inputs (number, null, undefined, object)
  • Constant export verification

Testing

  • All 13 tests pass via pnpm vitest run src/sessions/session-label.test.ts

Greptile Overview

Greptile Summary

This PR adds a new Vitest unit test file for src/sessions/session-label.ts, covering success cases (valid labels, trimming, unicode/special characters), boundary behavior at SESSION_LABEL_MAX_LENGTH, and failure cases for empty/whitespace-only and non-string inputs. The tests align with the current parseSessionLabel contract (returning { ok: true, label } or { ok: false, error }) and don’t introduce changes to production logic.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk.
  • The change is limited to a new unit test file exercising existing behavior in parseSessionLabel; the assertions match the current function outputs and don’t affect runtime code paths.
  • No files require special attention

Add 13 tests for the session label parsing module:

- Valid labels, whitespace trimming, special and unicode characters
- Max length boundary (exact limit and exceeding)
- Rejection of empty, whitespace-only, and non-string inputs
  (number, null, undefined, object)
- Constant export verification
@sebslight sebslight closed this Feb 7, 2026
SutanuNandigrami pushed a commit to SutanuNandigrami/openclaw that referenced this pull request Feb 8, 2026
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