Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
atn832 committed Nov 12, 2019
0 parents commit b5ae485
Show file tree
Hide file tree
Showing 8 changed files with 111 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Files and directories created by pub
.dart_tool/
.packages
# Remove the following pattern if you wish to check in your lock file
pubspec.lock

# Conventional directory for build outputs
build/

# Directory created by dartdoc
doc/api/

.flutter-plugins
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 1.0.0

- Initial version, created by Stagehand
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
A library for Dart developers.

Created from templates made available by Stagehand under a BSD-style
[license](https://github.com/dart-lang/stagehand/blob/master/LICENSE).

## Usage

A simple usage example:

```dart
import 'package:google_sign_in_mocks/google_sign_in_mocks.dart';
main() {
final googleSignIn = MockGoogleSignIn();
final signinAccount = await googleSignIn.signIn();
final signinAuthentication = await signinAccount.authentication;
}
```

## Features and bugs

Please file feature requests and bugs at the [issue tracker][tracker].

[tracker]: http://example.com/issues/replaceme
14 changes: 14 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Defines a default set of lint rules enforced for
# projects at Google. For details and rationale,
# see https://github.com/dart-lang/pedantic#enabled-lints.
include: package:pedantic/analysis_options.yaml

# For lint rules and documentation, see http://dart-lang.github.io/linter/lints.
# Uncomment to specify additional rules.
# linter:
# rules:
# - camel_case_types

analyzer:
# exclude:
# - path/to/excluded/files/**
8 changes: 8 additions & 0 deletions lib/google_sign_in_mocks.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/// Support for doing something awesome.
///
/// More dartdocs go here.
library google_sign_in_mocks;

export 'src/google_sign_in_mocks_base.dart';

// TODO: Export any libraries intended for clients of this package.
18 changes: 18 additions & 0 deletions lib/src/google_sign_in_mocks_base.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import 'package:google_sign_in/google_sign_in.dart';
import 'package:mockito/mockito.dart';

class MockGoogleSignIn extends Mock implements GoogleSignIn {
@override
Future<GoogleSignInAccount> signIn() {
return Future.value(MockGoogleSignInAccount());
}
}

class MockGoogleSignInAccount extends Mock implements GoogleSignInAccount {
@override
Future<GoogleSignInAuthentication> get authentication =>
Future.value(MockGoogleSignInAuthentication());
}

class MockGoogleSignInAuthentication extends Mock
implements GoogleSignInAuthentication {}
20 changes: 20 additions & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: google_sign_in_mocks
description: A starting point for Dart libraries or applications.
# version: 1.0.0
# homepage: https://www.example.com
# author: Anh Tuan Nguyen <atn832@gmail.com>

environment:
sdk: '>=2.2.0 <3.0.0'

dependencies:
flutter:
sdk: flutter
google_sign_in: ^4.0.11
mockito: ^4.1.0

dev_dependencies:
flutter_test:
sdk: flutter
pedantic: ^1.0.0
test: ^1.0.0
11 changes: 11 additions & 0 deletions test/google_sign_in_mocks_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import 'package:google_sign_in_mocks/google_sign_in_mocks.dart';
import 'package:test/test.dart';

void main() {
test('Basic test', () async {
final googleSignIn = MockGoogleSignIn();
final signinAccount = await googleSignIn.signIn();
final signinAuthentication = await signinAccount.authentication;
expect(signinAuthentication, isNotNull);
});
}

0 comments on commit b5ae485

Please sign in to comment.