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

Function TestIsSessionKey

pkg/session/session_test.go:163–184  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

161}
162
163func TestIsSessionKey(t *testing.T) {
164 tests := []struct {
165 key string
166 expected bool
167 }{
168 {"session:state1", true},
169 {"session:", false}, // 长度不够
170 {"app:setting1", false},
171 {"user:setting1", false},
172 {"temp:setting1", false},
173 {"state1", false},
174 }
175
176 for _, tt := range tests {
177 t.Run(tt.key, func(t *testing.T) {
178 result := IsSessionKey(tt.key)
179 if result != tt.expected {
180 t.Errorf("IsSessionKey(%q) = %v, expected %v", tt.key, result, tt.expected)
181 }
182 })
183 }
184}
185
186func TestGenerateEventID(t *testing.T) {
187 id1 := generateEventID()

Callers

nothing calls this directly

Calls 2

IsSessionKeyFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected