From 835d5e3248fc82f60d0b45e3640082b38d492ad3 Mon Sep 17 00:00:00 2001 From: Greg Price Date: Fri, 13 Oct 2023 21:14:29 -0700 Subject: [PATCH] wip nfc cut global default initialToken --- test/model/binding.dart | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test/model/binding.dart b/test/model/binding.dart index 815b7300ad..8c766f08ed 100644 --- a/test/model/binding.dart +++ b/test/model/binding.dart @@ -188,7 +188,7 @@ class TestZulipBinding extends ZulipBinding { } class FakeFirebaseMessaging extends Fake implements FirebaseMessaging { - String _initialToken = '0123456789abcdef'; + String? _initialToken; /// Set the token to a new value, as if it were newly generated. /// @@ -208,9 +208,14 @@ class FakeFirebaseMessaging extends Fake implements FirebaseMessaging { Future getToken({String? vapidKey}) async { assert(vapidKey == null); if (_token == null) { + assert(_initialToken != null, + 'Tests that call [NotificationService.start], or otherwise cause' + ' a call to `ZulipBinding.instance.firebaseMessaging.getToken`,' + ' must set `testBinding.firebaseMessagingInitialToken` first.'); + // This causes [onTokenRefresh] to fire, just like the real [getToken] // does when no token exists (e.g., on first run after install). - setToken(_initialToken); + setToken(_initialToken!); } return _token; }