Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(DropDownAlert): add unit test #2

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions test/dropdown_alert_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import 'package:flutter/material.dart';
import 'package:flutter_dropdown_alert/alert_controller.dart';
import 'package:flutter_dropdown_alert/dropdown_alert.dart';
import 'package:flutter_dropdown_alert/model/data_alert.dart';
import 'package:flutter_test/flutter_test.dart';

void main() {
group('GIVEN use Dropdown Alert', () {
testWidgets('WHEN open screen, THEN should render basic successfully',
(WidgetTester tester) async {
// Given
final sut = MaterialApp(
home: Scaffold(
body: const Text('test'),
),
builder: (context, child) {
return Stack(
children: [
const DropdownAlert(),
child!,
],
);
},
);

// When
await tester.pumpWidget(sut);

// workaround here
AlertController.show(
'dummy for init timer',
'message',
TypeAlert.warning,
{},
);
AlertController.show(
'dummy for init timer',
'message',
TypeAlert.warning,
{},
);
await tester.pumpAndSettle();
// Then
});
});
}