Skip to content

Commit 8bba363

Browse files
committed
fix tests
1 parent f4826dd commit 8bba363

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/ParquetViewer.Tests/TestAmplitudeEvent.cs

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public TestAmplitudeEvent(string dummyApiKey) : base(EVENT_TYPE)
2020
public void SwapHttpClientHandler(HttpMessageHandler mockHandler)
2121
{
2222
HttpMessageHandler = mockHandler;
23+
BypassConsentRequirement = true;
2324
}
2425
}
2526
}

src/ParquetViewer/Analytics/AmplitudeEvent.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public abstract class AmplitudeEvent
1717
private static readonly int _systemRAM = (int)(GC.GetGCMemoryInfo().TotalAvailableMemoryBytes / 1048576.0 /*magic number*/);
1818

1919
protected HttpMessageHandler HttpMessageHandler { get; set; } = new HttpClientHandler();
20+
protected bool BypassConsentRequirement { get; set; }
2021

2122
[JsonIgnore]
2223
public string DeviceId => AppSettings.AnalyticsDeviceId.ToString();
@@ -48,7 +49,7 @@ public async Task<bool> Record()
4849
{
4950
try
5051
{
51-
if (AMPLITUDE_API_KEY.Length == 0 || !AppSettings.AnalyticsDataGatheringConsent)
52+
if (!BypassConsentRequirement && (AMPLITUDE_API_KEY.Length == 0 || !AppSettings.AnalyticsDataGatheringConsent))
5253
return false;
5354

5455
var request = new

0 commit comments

Comments
 (0)