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

Function TestGetTimelineCount

pkg/events/bus_test.go:241–256  ·  view source on GitHub ↗

TestGetTimelineCount 测试获取事件数量

(t *testing.T)

Source from the content-addressed store, hash-verified

239
240// TestGetTimelineCount 测试获取事件数量
241func TestGetTimelineCount(t *testing.T) {
242 eb := NewEventBus()
243 defer eb.Close()
244
245 if eb.GetTimelineCount() != 0 {
246 t.Error("initial count should be 0")
247 }
248
249 for i := range 10 {
250 eb.EmitProgress(&types.ProgressTextChunkEvent{Step: i, Delta: "test"})
251 }
252
253 if eb.GetTimelineCount() != 10 {
254 t.Errorf("expected count 10, got %d", eb.GetTimelineCount())
255 }
256}
257
258// TestAutoCleanupWorker 测试自动清理 worker
259func TestAutoCleanupWorker(t *testing.T) {

Callers

nothing calls this directly

Calls 5

CloseMethod · 0.95
GetTimelineCountMethod · 0.95
EmitProgressMethod · 0.95
NewEventBusFunction · 0.85
ErrorMethod · 0.65

Tested by

no test coverage detected