jonataslaw / get_storage

A fast, extra light and synchronous key-value storage to Get framework
MIT License
369 stars 83 forks source link

i got error when create test call some function! #75

Open chanthavong opened 3 years ago

chanthavong commented 3 years ago

Future<void> main() async {
  const channel = MethodChannel('plugins.flutter.io/path_provider');
  void setUpMockChannels(MethodChannel channel) {
    TestWidgetsFlutterBinding.ensureInitialized();
    channel.setMockMethodCallHandler((MethodCall methodCall) async {
      if (methodCall.method == 'getApplicationDocumentsDirectory') {
        return '.';
      }
    });
  }

  setUpAll(() async {
    setUpMockChannels(channel);
  });

  setUp(() async {
    await GetStorage.init();
  });

  group('Auth Testing', () {
    var auth = Auth();
    test('Login Demo', () async {
      var login = await auth.login('demo', 'demo1234');
      expect(login.statusCode, 200);
    });

    test('Refresh token', () async {
      expect(await auth.refreshToken(), true);
    });

  });
}

error text

Null check operator used on a null value package:get_storage/src/storage_impl.dart 47:7 GetStorage._init ===== asynchronous gap =========================== package:get_storage/src/storage_impl.dart 28:7 new GetStorage._internal.