MCPcopy Create free account
hub / github.com/diillson/chatcli / TestHandler_LoadSession_V1Fallback

Function TestHandler_LoadSession_V1Fallback

server/handler_test.go:593–612  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

591}
592
593func TestHandler_LoadSession_V1Fallback(t *testing.T) {
594 // Store does NOT implement SessionStoreV2 — should fall back to v1
595 logger := zap.NewNop()
596 store := &mockSessionStore{}
597
598 history := []models.Message{
599 {Role: "user", Content: "hello"},
600 }
601 store.On("LoadSession", "test-v1").Return(history, nil)
602
603 handler := &Handler{
604 sessionManager: store,
605 logger: logger,
606 }
607
608 resp, err := handler.LoadSession(context.Background(), &pb.LoadSessionRequest{Name: "test-v1"})
609 assert.NoError(t, err)
610 assert.Len(t, resp.Messages, 1)
611 assert.Nil(t, resp.SessionData) // No v2 data from v1 store
612}
613
614func TestProtoModelV2Roundtrip(t *testing.T) {
615 // Test that converting models → proto → models preserves all data including Meta

Callers

nothing calls this directly

Calls 2

LoadSessionMethod · 0.95
LenMethod · 0.45

Tested by

no test coverage detected