Skip to content

Commit

Permalink
Merge pull request #19 from Adyen/feature/add_github_action
Browse files Browse the repository at this point in the history
Create check_pr.yml
  • Loading branch information
Robert-SD authored Aug 28, 2023
2 parents ac0f6c8 + a031b00 commit f437811
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 7 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/check_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Dart

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 30

steps:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.10.6'
channel: 'stable'
cache: true
- run: flutter --version

- name: Install dependencies
run: flutter pub get

- name: Analyze project source
run: dart analyze

- name: Run tests
run: flutter test
4 changes: 2 additions & 2 deletions example/integration_test/plugin_integration_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ void main() {

testWidgets('getPlatformVersion test', (WidgetTester tester) async {
final AdyenCheckout plugin = AdyenCheckout();
final String? version = await plugin.getPlatformVersion();
final String version = await plugin.getPlatformVersion();
// The version string depends on the host platform running the test, so
// just assert that some non-empty string is returned.
expect(version?.isNotEmpty, true);
expect(version.isNotEmpty, true);
});
}
3 changes: 1 addition & 2 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ class _MyAppState extends State<MyApp> {
// Platform messages may fail, so we use a try/catch PlatformException.
// We also handle the message potentially returning null.
try {
platformVersion = await _adyenCheckout.getPlatformVersion() ??
'Unknown platform version';
platformVersion = await _adyenCheckout.getPlatformVersion();
} on PlatformException {
platformVersion = 'Failed to get platform version.';
}
Expand Down
2 changes: 1 addition & 1 deletion example/test/widget_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('Verify Platform version', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(const MyApp());
await tester.pumpWidget(const MaterialApp(home: MyApp()));

// Verify that platform version is retrieved.
expect(
Expand Down
3 changes: 1 addition & 2 deletions test/adyen_checkout_test.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'package:adyen_checkout/platform_api.g.dart';
import 'package:adyen_checkout/src/adyen_checkout.dart';
import 'package:adyen_checkout/src/adyen_checkout_interface.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';

Expand All @@ -25,7 +24,7 @@ class MockAdyenCheckoutPlatform
}

void main() {
WidgetsFlutterBinding.ensureInitialized();
TestWidgetsFlutterBinding.ensureInitialized();
final AdyenCheckout initialPlatform = AdyenCheckout();

test('$AdyenCheckout is the default instance', () {
Expand Down

0 comments on commit f437811

Please sign in to comment.