MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / TestManager_GetByPrefix

Function TestManager_GetByPrefix

internal/sessions/transfer_test.go:725–742  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

723}
724
725func TestManager_GetByPrefix(t *testing.T) {
726 mgr := NewManager(10 * time.Minute)
727 s1 := mgr.Touch("key1", "agent/1.0", "openai", "abcdef123456")
728 mgr.Touch("key2", "agent/2.0", "openai", "xyz789000000")
729
730 // Exact prefix match.
731 if got := mgr.GetByPrefix("abcdef"); got == nil || got.ID != s1.ID {
732 t.Errorf("prefix 'abcdef' should match session %s", s1.ID)
733 }
734 // No match.
735 if got := mgr.GetByPrefix("zzz"); got != nil {
736 t.Error("prefix 'zzz' should return nil")
737 }
738 // Empty prefix.
739 if got := mgr.GetByPrefix(""); got != nil {
740 t.Error("empty prefix should return nil")
741 }
742}
743
744// ===================================================================
745// E. Transfer Planning Tests

Callers

nothing calls this directly

Calls 4

TouchMethod · 0.95
GetByPrefixMethod · 0.95
NewManagerFunction · 0.70
ErrorMethod · 0.45

Tested by

no test coverage detected