-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathTelemetryEnricherTest.cs
34 lines (29 loc) · 1.15 KB
/
TelemetryEnricherTest.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using Coder.Desktop.Vpn.Proto;
using Coder.Desktop.Vpn.Service;
namespace Coder.Desktop.Tests.Vpn.Service;
[TestFixture]
public class TelemetryEnricherTest
{
[Test]
public void EnrichStartRequest()
{
var req = new StartRequest
{
CoderUrl = "https://coder.example.com",
};
var enricher = new TelemetryEnricher();
req = enricher.EnrichStartRequest(req);
// quick sanity check that non-telemetry fields aren't lost or overwritten
Assert.That(req.CoderUrl, Is.EqualTo("https://coder.example.com"));
Assert.That(req.DeviceOs, Is.EqualTo("Windows"));
// seems that test assemblies always set 1.0.0.0
Assert.That(req.CoderDesktopVersion, Is.EqualTo("1.0.0.0"));
Assert.That(req.DeviceId, Is.Not.Empty);
var deviceId = req.DeviceId;
// deviceId is different on different machines, but we can test that
// each instance of the TelemetryEnricher produces the same value.
enricher = new TelemetryEnricher();
req = enricher.EnrichStartRequest(new StartRequest());
Assert.That(req.DeviceId, Is.EqualTo(deviceId));
}
}