(t *testing.T)
| 62 | } |
| 63 | |
| 64 | func TestContextInjector_InjectSessionState(t *testing.T) { |
| 65 | state := &SessionState{ |
| 66 | SessionID: "session-123", |
| 67 | MessageCount: 42, |
| 68 | Duration: 30 * time.Minute, |
| 69 | CustomState: map[string]any{ |
| 70 | "mode": "debug", |
| 71 | }, |
| 72 | } |
| 73 | |
| 74 | config := InjectorConfig{ |
| 75 | EnableSessionState: true, |
| 76 | SessionStateProvider: NewSimpleSessionStateProvider(state), |
| 77 | } |
| 78 | |
| 79 | injector := NewContextInjector(config) |
| 80 | systemPrompt := "You are a helpful assistant." |
| 81 | |
| 82 | result := injector.InjectContext(context.Background(), systemPrompt) |
| 83 | |
| 84 | if !strings.Contains(result, "Session State") { |
| 85 | t.Error("expected session state context to be injected") |
| 86 | } |
| 87 | |
| 88 | if !strings.Contains(result, "session-123") { |
| 89 | t.Error("expected session ID to be included") |
| 90 | } |
| 91 | |
| 92 | if !strings.Contains(result, "42") { |
| 93 | t.Error("expected message count to be included") |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | func TestContextInjector_MultipleContexts(t *testing.T) { |
| 98 | config := InjectorConfig{ |
nothing calls this directly
no test coverage detected