-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make TrackEvent not require parameters
- Loading branch information
Dan Caseley
committed
Aug 25, 2021
1 parent
90db638
commit b5efc5e
Showing
3 changed files
with
62 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import 'package:analyticsx/analytics_x.dart'; | ||
import 'package:test/test.dart'; | ||
|
||
import 'util/vendors_and_actions.dart'; | ||
|
||
void main() { | ||
late AnalyticsX ax; | ||
|
||
setUp(() { | ||
ax = AnalyticsX(); | ||
}); | ||
|
||
tearDown(() { | ||
ax.reset(); | ||
}); | ||
|
||
group('TrackEvent', () { | ||
test('TrackEvent is recorded', () async { | ||
const testEventName = 'test_event'; | ||
const testParams = {'p1': 'one', 'p2': 'two'}; | ||
final recordingVendor = RecordingVendor(); | ||
|
||
await ax.init([recordingVendor]); | ||
await ax.invokeAction(TrackEvent(testEventName, testParams)); | ||
|
||
expect(recordingVendor.trackEventRecordings, {testEventName: testParams}); | ||
}); | ||
|
||
test('TrackEvent is recorded without params', () async { | ||
const testEventName = 'test_event'; | ||
final recordingVendor = RecordingVendor(); | ||
|
||
await ax.init([recordingVendor]); | ||
await ax.invokeAction(TrackEvent(testEventName)); | ||
|
||
expect(recordingVendor.trackEventRecordings, {testEventName: null}); | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters