MCPcopy Create free account
hub / github.com/astercloud/aster / TestContextInjector_InjectLocation

Function TestContextInjector_InjectLocation

pkg/context/auto_inject_test.go:33–62  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

31}
32
33func TestContextInjector_InjectLocation(t *testing.T) {
34 location := &LocationInfo{
35 City: "San Francisco",
36 Country: "USA",
37 Timezone: "America/Los_Angeles",
38 Language: "en-US",
39 }
40
41 config := InjectorConfig{
42 EnableLocation: true,
43 LocationProvider: NewSimpleLocationProvider(location),
44 }
45
46 injector := NewContextInjector(config)
47 systemPrompt := "You are a helpful assistant."
48
49 result := injector.InjectContext(context.Background(), systemPrompt)
50
51 if !strings.Contains(result, "Location Information") {
52 t.Error("expected location context to be injected")
53 }
54
55 if !strings.Contains(result, "San Francisco") {
56 t.Error("expected city to be included")
57 }
58
59 if !strings.Contains(result, "USA") {
60 t.Error("expected country to be included")
61 }
62}
63
64func TestContextInjector_InjectSessionState(t *testing.T) {
65 state := &SessionState{

Callers

nothing calls this directly

Calls 4

InjectContextMethod · 0.95
NewContextInjectorFunction · 0.85
ErrorMethod · 0.65

Tested by

no test coverage detected