(t *testing.T)
| 348 | } |
| 349 | |
| 350 | func TestServiceDeviceIDFallback(t *testing.T) { |
| 351 | // Given device ID discovery fails |
| 352 | t.Cleanup(stubDeviceIDError(errors.New("no device id"))) |
| 353 | var captured SendTelemetryPayload |
| 354 | service := NewService(func(p SendTelemetryPayload) { captured = p }) |
| 355 | |
| 356 | // When a recorded event is completed and delivered |
| 357 | service.Record(ghtelemetry.Event{Type: "test"}) |
| 358 | service.Finish() |
| 359 | |
| 360 | // Then the payload identifies the device as unknown |
| 361 | require.Len(t, captured.Events, 1) |
| 362 | assert.Equal(t, "<unknown>", captured.Events[0].Dimensions["device_id"]) |
| 363 | } |
| 364 | |
| 365 | func TestServiceFinish(t *testing.T) { |
| 366 | t.Run("logs none when no events recorded", func(t *testing.T) { |
nothing calls this directly
no test coverage detected