-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feature/ampliude_plugin
- Loading branch information
Showing
36 changed files
with
3,770 additions
and
71 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,4 +38,7 @@ build/ | |
launch.json | ||
|
||
#Coverage | ||
coverage/ | ||
coverage/ | ||
|
||
# FVM Version Cache | ||
.fvm/ |
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
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
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
// coverage:ignore-file | ||
import 'dart:async'; | ||
import 'dart:convert'; | ||
import 'dart:io'; | ||
|
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,33 @@ | ||
// test/analytics_platform_impl_test.dart | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:mockito/mockito.dart'; | ||
import 'package:segment_analytics/analytics_pigeon.dart'; | ||
|
||
import 'package:segment_analytics/native_context.dart'; | ||
import 'mocks/mocks.mocks.dart'; | ||
|
||
void main() { | ||
TestWidgetsFlutterBinding.ensureInitialized(); | ||
|
||
group('AnalyticsPlatformImpl Tests', () { | ||
late AnalyticsPlatformImpl analyticsPlatform; | ||
late MockNativeContextApi mockNativeContextApi; | ||
|
||
setUp(() { | ||
mockNativeContextApi = MockNativeContextApi(); | ||
analyticsPlatform = AnalyticsPlatformImpl(); | ||
analyticsPlatform.api = mockNativeContextApi; | ||
}); | ||
|
||
test('getContext returns NativeContext', () async { | ||
final nativeContext = NativeContext(); | ||
when(mockNativeContextApi.getContext(any)) | ||
.thenAnswer((_) async => nativeContext); | ||
|
||
final result = await analyticsPlatform.getContext(collectDeviceId: true); | ||
|
||
expect(result, isA<NativeContext>()); | ||
verify(mockNativeContextApi.getContext(true)).called(1); | ||
}); | ||
}); | ||
} |
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,43 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'dart:async'; | ||
|
||
import 'package:segment_analytics/client.dart'; | ||
|
||
|
||
void main() { | ||
late ScreenObserver screenObserver; | ||
late Stream<String> screenStream; | ||
late List<String> events; | ||
|
||
setUp(() { | ||
screenObserver = ScreenObserver(); | ||
screenStream = screenObserver.screenStream; | ||
events = []; | ||
screenStream.listen((event) { | ||
events.add(event); | ||
}); | ||
}); | ||
|
||
test('didPop adds previous route name to stream', () { | ||
final route = MaterialPageRoute(settings: const RouteSettings(name: '/new'), builder: (_) => Container()); | ||
final previousRoute = MaterialPageRoute(settings: const RouteSettings(name: '/old'), builder: (_) => Container()); | ||
screenObserver.didPop(route, previousRoute); | ||
}); | ||
|
||
test('didPush adds new route name to stream', () { | ||
final route = MaterialPageRoute(settings: const RouteSettings(name: '/new'), builder: (_) => Container()); | ||
screenObserver.didPush(route, null); | ||
}); | ||
|
||
test('didRemove adds route name to stream', () { | ||
final route = MaterialPageRoute(settings: const RouteSettings(name: '/remove'), builder: (_) => Container()); | ||
screenObserver.didRemove(route, null); | ||
}); | ||
|
||
test('didReplace adds new route name to stream', () { | ||
final oldRoute = MaterialPageRoute(settings: const RouteSettings(name: '/old'), builder: (_) => Container()); | ||
final newRoute = MaterialPageRoute(settings: const RouteSettings(name: '/new'), builder: (_) => Container()); | ||
screenObserver.didReplace(newRoute: newRoute, oldRoute: oldRoute); | ||
}); | ||
} |
Oops, something went wrong.