Skip to content

Commit

Permalink
test(firebase_core): migrate tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pr-Mais committed Nov 22, 2021
1 parent 1595a07 commit 3938ceb
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 33 deletions.
Expand Up @@ -6,7 +6,7 @@ publish_to: 'none'
version: 1.0.0+1

environment:
sdk: ">=2.7.0 <3.0.0"
sdk: '>=2.7.0 <3.0.0'

dependencies:
cupertino_icons: ^0.1.2
Expand All @@ -30,7 +30,7 @@ dependency_overrides:
path: ../../../firebase_core/firebase_core_web

dev_dependencies:
drive: 0.1.0
drive: ^1.0.0-1.0.nullsafety.1
flutter_driver:
sdk: flutter
test: any
Expand Down
@@ -1,6 +1,3 @@
// ignore_for_file: require_trailing_commas
// @dart = 2.9

// Copyright 2021, the Chromium project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
Expand Down
@@ -1,5 +1,3 @@
// ignore_for_file: require_trailing_commas
// @dart=2.9
// Copyright 2021, the Chromium project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
Expand Down
4 changes: 2 additions & 2 deletions packages/firebase_core/firebase_core/example/pubspec.yaml
Expand Up @@ -2,7 +2,7 @@ name: firebase_core_example
description: Demonstrates how to use the firebase_core plugin.

environment:
sdk: ">=2.12.0 <3.0.0"
sdk: '>=2.12.0 <3.0.0'

dependencies:
firebase_core:
Expand All @@ -17,7 +17,7 @@ dependency_overrides:
path: ../../firebase_core_web

dev_dependencies:
e2e: ^0.6.1
drive: ^1.0.0-1.0.nullsafety.1
flutter_driver:
sdk: flutter
flutter_test:
Expand Down
@@ -1,23 +1,20 @@
// ignore_for_file: require_trailing_commas
// @dart = 2.9

// Copyright 2019, the Chromium project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

// @dart=2.9

import 'dart:io';
import 'package:e2e/e2e.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_core_platform_interface/firebase_core_platform_interface.dart';
import 'package:flutter_test/flutter_test.dart';

void main() {
E2EWidgetsFlutterBinding.ensureInitialized();
import 'package:drive/drive.dart' as drive;

void main() => drive.main(testsMain);

void testsMain() {
String testAppName = 'TestApp';
FirebaseOptions testAppOptions;
FirebaseOptions? testAppOptions;

if (Platform.isIOS || Platform.isMacOS) {
testAppOptions = const FirebaseOptions(
appId: '1:448618578101:ios:0b650370bb29e29cac3efc',
Expand All @@ -39,28 +36,28 @@ void main() {
await Firebase.initializeApp(name: testAppName, options: testAppOptions);
});

testWidgets('Firebase.apps', (WidgetTester tester) async {
test('Firebase.apps', () async {
List<FirebaseApp> apps = Firebase.apps;
expect(apps.length, 1);
expect(apps[0].name, testAppName);
expect(apps[0].options, testAppOptions);
});

testWidgets('Firebase.app()', (WidgetTester tester) async {
test('Firebase.app()', () async {
FirebaseApp app = Firebase.app(testAppName);

expect(app.name, testAppName);
expect(app.options, testAppOptions);
});

testWidgets('Firebase.app() Exception', (WidgetTester tester) async {
test('Firebase.app() Exception', () async {
expect(
() => Firebase.app('NoApp'),
throwsA(noAppExists('NoApp')),
);
});

testWidgets('FirebaseApp.delete()', (WidgetTester tester) async {
test('FirebaseApp.delete()', () async {
await Firebase.initializeApp(name: 'SecondaryApp', options: testAppOptions);

expect(Firebase.apps.length, 2);
Expand All @@ -72,8 +69,7 @@ void main() {
expect(Firebase.apps.length, 1);
});

testWidgets('FirebaseApp.setAutomaticDataCollectionEnabled()',
(WidgetTester tester) async {
test('FirebaseApp.setAutomaticDataCollectionEnabled()', () async {
FirebaseApp app = Firebase.app(testAppName);
bool enabled = app.isAutomaticDataCollectionEnabled;

Expand All @@ -82,8 +78,7 @@ void main() {
expect(app.isAutomaticDataCollectionEnabled, !enabled);
});

testWidgets('FirebaseApp.setAutomaticResourceManagementEnabled()',
(WidgetTester tester) async {
test('FirebaseApp.setAutomaticResourceManagementEnabled()', () async {
FirebaseApp app = Firebase.app(testAppName);

await app.setAutomaticResourceManagementEnabled(true);
Expand Down
@@ -1,12 +1,7 @@
// ignore_for_file: require_trailing_commas
// @dart = 2.9

// Copyright 2020, the Chromium project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

// @dart=2.9

import 'package:e2e/e2e_driver.dart' as e2e;
import 'package:drive/drive_driver.dart' as drive;

Future<void> main() async => e2e.main();
void main() => drive.main();

0 comments on commit 3938ceb

Please sign in to comment.