TestGetTimelineCount 测试获取事件数量
(t *testing.T)
| 239 | |
| 240 | // TestGetTimelineCount 测试获取事件数量 |
| 241 | func 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 |
| 259 | func TestAutoCleanupWorker(t *testing.T) { |
nothing calls this directly
no test coverage detected