(t *testing.T)
| 74 | } |
| 75 | |
| 76 | func TestServiceFinishDeliversOnce(t *testing.T) { |
| 77 | t.Cleanup(stubDeviceID("test-device")) |
| 78 | |
| 79 | // Given an invocation with a recorded event |
| 80 | deliveries := 0 |
| 81 | service := NewService(func(SendTelemetryPayload) { deliveries++ }) |
| 82 | service.Record(ghtelemetry.Event{Type: "test"}) |
| 83 | |
| 84 | // When completion is called twice |
| 85 | service.Finish() |
| 86 | service.Finish() |
| 87 | |
| 88 | // Then the payload is delivered only once |
| 89 | assert.Equal(t, 1, deliveries) |
| 90 | } |
| 91 | |
| 92 | func TestServiceRecordingDoesNotWaitForDelivery(t *testing.T) { |
| 93 | t.Cleanup(stubDeviceID("test-device")) |
nothing calls this directly
no test coverage detected