(t *testing.T)
| 369 | } |
| 370 | |
| 371 | func TestServiceDeviceIDFallback(t *testing.T) { |
| 372 | t.Cleanup(stubDeviceIDError(errors.New("no device id"))) |
| 373 | |
| 374 | var captured SendTelemetryPayload |
| 375 | svc := newService(func(p SendTelemetryPayload) { captured = p }, nil) |
| 376 | |
| 377 | svc.Record(ghtelemetry.Event{Type: "test"}) |
| 378 | svc.Flush() |
| 379 | |
| 380 | require.Len(t, captured.Events, 1) |
| 381 | assert.Equal(t, "<unknown>", captured.Events[0].Dimensions["device_id"]) |
| 382 | } |
| 383 | |
| 384 | func TestServiceFlush(t *testing.T) { |
| 385 | t.Run("calls flusher with empty payload when no events recorded", func(t *testing.T) { |
nothing calls this directly
no test coverage detected