File tree Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ dependencies:
1414 sdk : flutter
1515
1616dev_dependencies :
17+ test : ^1.5.1
1718 flutter_test :
1819 sdk : flutter
1920
Original file line number Diff line number Diff line change @@ -64,6 +64,12 @@ class OneSignalMockChannelController {
6464 case "OneSignal#deleteTags" :
6565 this .state.deleteTags = call.arguments;
6666 return {"success" : true };
67+ case "OneSignal#setExternalUserId" :
68+ this .state.externalId = (call.arguments as Map <dynamic , dynamic >)['externalUserId' ] as String ;
69+ return {"success" : true };
70+ case "OneSignal#removeExternalUserId" :
71+ this .state.externalId = null ;
72+ return {"success" : true };
6773 }
6874 }
6975}
@@ -90,6 +96,7 @@ class OneSignalState {
9096 bool locationShared;
9197 OSNotificationDisplayType inFocusDisplayType;
9298 bool subscriptionState;
99+ String externalId;
93100
94101 // tags
95102 Map <dynamic , dynamic > tags;
Original file line number Diff line number Diff line change @@ -111,4 +111,16 @@ void main() {
111111 expect (channelController.state.deleteTags, ['test1' ]);
112112 }));
113113 });
114+
115+ test ('setting external user ID' , () {
116+ onesignal.setExternalUserId ('test_ext_id' ).then (expectAsync1 ((v) {
117+ expect (channelController.state.externalId, 'test_ext_id' );
118+ }));
119+ });
120+
121+ test ('removing external user ID' , () {
122+ onesignal.removeExternalUserId ().then (expectAsync1 ((v) {
123+ expect (channelController.state.externalId, null );
124+ }));
125+ });
114126}
You can’t perform that action at this time.
0 commit comments