Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
eliasyishak committed Oct 20, 2023
1 parent 9294177 commit fa69568
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
12 changes: 6 additions & 6 deletions pkgs/unified_analytics/test/log_handler_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ void main() {
final countOfEventsToSend = 10;

for (var i = 0; i < countOfEventsToSend; i++) {
await analytics.send(testEvent);
analytics.send(testEvent);
}

expect(analytics.logFileStats(), isNotNull);
Expand All @@ -91,7 +91,7 @@ void main() {
final countOfEventsToSend = 10;

for (var i = 0; i < countOfEventsToSend; i++) {
await analytics.send(testEvent);
analytics.send(testEvent);
}
final logFileStats = analytics.logFileStats();

Expand All @@ -110,7 +110,7 @@ void main() {
final countOfEventsToSend = 10;

for (var i = 0; i < countOfEventsToSend; i++) {
await analytics.send(testEvent);
analytics.send(testEvent);
}
final logFileStats = analytics.logFileStats();

Expand Down Expand Up @@ -149,7 +149,7 @@ void main() {
// one malformed record on top of the logs and the rest
// are valid log records
for (var i = 0; i < kLogFileLength - 1; i++) {
await analytics.send(testEvent);
analytics.send(testEvent);
}
final logFileStats = analytics.logFileStats();
expect(logFile.readAsLinesSync().length, kLogFileLength);
Expand All @@ -159,7 +159,7 @@ void main() {
expect(logFile.readAsLinesSync()[0].trim(), '{{');

// Sending one more event should flush out the malformed record
await analytics.send(testEvent);
analytics.send(testEvent);

final secondLogFileStats = analytics.logFileStats();
expect(secondLogFileStats, isNotNull);
Expand All @@ -178,7 +178,7 @@ void main() {
// Ensure it will work as expected after writing correct logs
final countOfEventsToSend = 10;
for (var i = 0; i < countOfEventsToSend; i++) {
await analytics.send(testEvent);
analytics.send(testEvent);
}
final secondLogFileStats = analytics.logFileStats();

Expand Down
6 changes: 3 additions & 3 deletions pkgs/unified_analytics/test/suppression_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ void main() {

test('Suppression works as expected', () async {
analytics.suppressTelemetry();
await analytics.send(testEvent);
analytics.send(testEvent);

final logFileStats = analytics.logFileStats();

Expand All @@ -86,7 +86,7 @@ void main() {

test('Second instance is not suppressed', () async {
analytics.suppressTelemetry();
await analytics.send(testEvent);
analytics.send(testEvent);

final logFileStats = analytics.logFileStats();

Expand All @@ -110,7 +110,7 @@ void main() {

// Using a new event here to differentiate from the first one
final newEvent = Event.commandExecuted(count: 2, name: 'commandName');
await secondAnalytics.send(newEvent);
secondAnalytics.send(newEvent);

// Both instances of `Analytics` should now have data retrieved
// from `LogFileStats()` even though only the second instance
Expand Down
20 changes: 10 additions & 10 deletions pkgs/unified_analytics/test/survey_handler_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ void main() {

// Simulate 60 events to send so that the first condition is satisified
for (var i = 0; i < 60; i++) {
await analytics.send(testEvent);
analytics.send(testEvent);
}

final fetchedSurveys = await analytics.fetchAvailableSurveys();
Expand Down Expand Up @@ -405,7 +405,7 @@ void main() {

// Simulate 60 events to send so that the first condition is satisified
for (var i = 0; i < 60; i++) {
await analytics.send(testEvent);
analytics.send(testEvent);
}

final fetchedSurveys = await analytics.fetchAvailableSurveys();
Expand Down Expand Up @@ -448,7 +448,7 @@ void main() {

// Simulate 60 events to send so that the first condition is satisified
for (var i = 0; i < 60; i++) {
await analytics.send(testEvent);
analytics.send(testEvent);
}

await analytics.setTelemetry(false);
Expand Down Expand Up @@ -515,7 +515,7 @@ void main() {

// Simulate 60 events to send so that the first condition is satisified
for (var i = 0; i < 60; i++) {
await analytics.send(testEvent);
analytics.send(testEvent);
}

final fetchedSurveys = await analytics.fetchAvailableSurveys();
Expand Down Expand Up @@ -617,7 +617,7 @@ void main() {

// Simulate 60 events to send so that the first condition is satisified
for (var i = 0; i < 60; i++) {
await analytics.send(testEvent);
analytics.send(testEvent);
}

final fetchedSurveys = await analytics.fetchAvailableSurveys();
Expand Down Expand Up @@ -686,7 +686,7 @@ void main() {

// Simulate 60 events to send so that the first condition is satisified
for (var i = 0; i < 60; i++) {
await analytics.send(testEvent);
analytics.send(testEvent);
}

final fetchedSurveys = await analytics.fetchAvailableSurveys();
Expand Down Expand Up @@ -743,7 +743,7 @@ void main() {

// Simulate 60 events to send so that the first condition is satisified
for (var i = 0; i < 60; i++) {
await analytics.send(testEvent);
analytics.send(testEvent);
}

// Setting to false will prevent anything from getting returned
Expand All @@ -758,7 +758,7 @@ void main() {
// at least 50 records for one of the conditions
await analytics.setTelemetry(true);
for (var i = 0; i < 60; i++) {
await analytics.send(testEvent);
analytics.send(testEvent);
}
fetchedSurveys = await analytics.fetchAvailableSurveys();
expect(fetchedSurveys.length, 1);
Expand Down Expand Up @@ -805,7 +805,7 @@ void main() {

// Simulate 60 events to send so that the first condition is satisified
for (var i = 0; i < 60; i++) {
await analytics.send(testEvent);
analytics.send(testEvent);
}

final fetchedSurveys = await analytics.fetchAvailableSurveys();
Expand Down Expand Up @@ -851,7 +851,7 @@ void main() {

// Simulate 60 events to send so that the first condition is satisified
for (var i = 0; i < 60; i++) {
await analytics.send(testEvent);
analytics.send(testEvent);
}

final fetchedSurveys = await analytics.fetchAvailableSurveys();
Expand Down

0 comments on commit fa69568

Please sign in to comment.