From dafb8d807aea6f95ea900ed2a01d7f2b43d57f24 Mon Sep 17 00:00:00 2001 From: dreautall <109872040+dreautall@users.noreply.github.com> Date: Sat, 24 Feb 2024 18:26:19 +0000 Subject: [PATCH] [test] mock `flutter_timezone` method channel --- test/auth_test.dart | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/auth_test.dart b/test/auth_test.dart index 16fd295c..60ff3d24 100644 --- a/test/auth_test.dart +++ b/test/auth_test.dart @@ -3,6 +3,7 @@ import 'dart:convert'; import 'dart:io'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart' show TestWidgetsFlutterBinding; import 'package:http/http.dart' as http; import 'package:mockito/annotations.dart'; @@ -47,6 +48,13 @@ class MockCallbackFunction extends Mock { void main() { TestWidgetsFlutterBinding.ensureInitialized(); + TestWidgetsFlutterBinding.instance.defaultBinaryMessenger + .setMockMethodCallHandler( + const MethodChannel('flutter_timezone'), + (MethodCall methodCall) async { + return "Europe/Berlin"; + }, + ); group("AuthError", () { test("AuthErrorHost", () {