Skip to content

test(desktop): add wire.go and sessions.go tests#2452

Merged
esengine merged 1 commit into
esengine:main-v2from
HUQIANTAO:test/desktop-wire-sessions
May 31, 2026
Merged

test(desktop): add wire.go and sessions.go tests#2452
esengine merged 1 commit into
esengine:main-v2from
HUQIANTAO:test/desktop-wire-sessions

Conversation

@HUQIANTAO
Copy link
Copy Markdown
Contributor

Summary

Add 27 tests for the desktop package's pure-logic functions:

wire.go tests (14 tests)

  • toWire: text, reasoning, notice (info/warn), tool dispatch/result, usage (with/without pricing), approval request, ask request, turn_done (with/without error)
  • kindNames completeness: all 12 event kinds mapped
  • wireEvent JSON round-trip

sessions.go tests (13 tests)

  • loadSessionTitles: missing file, corrupt JSON, valid data
  • saveSessionTitles: creates nested directory, round-trip
  • setSessionTitle: set/clear, whitespace trimming
  • deleteSessionFile: with title, without title, missing file
  • sessionTitlesPath: correct path
  • errActiveSession: has message

Motivation

The desktop package had only dotenv_test.go. The toWire() function (event-to-JSON conversion) and session management (titles, delete) are pure logic testable without Wails runtime. These tests ensure the wire protocol stays consistent and session file operations are correct.

@github-actions github-actions Bot added the v2 Go rewrite (1.x) — main-v2 branch, active development label May 31, 2026
@esengine esengine merged commit d9f06bd into esengine:main-v2 May 31, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants