Skip to content

Instantly share code, notes, and snippets.

@antklim
Created November 11, 2020 05:55
Show Gist options
  • Save antklim/ccb022590b1f29dd88f6eb280b72b2bf to your computer and use it in GitHub Desktop.
Save antklim/ccb022590b1f29dd88f6eb280b72b2bf to your computer and use it in GitHub Desktop.
void main() {
group('Calculus screen', () {
...
testWidgets('has one operand when operation is SQRT', (WidgetTester tester) async {
// initiate required state
CalculatorState state = CalculatorState();
state.setOperation(Sqrt);
await tester.pumpWidget(MaterialApp(
home: ChangeNotifierProvider<CalculatorState>(
create: (_) => state, // passing state to widgtes
builder: (context, _) => CalculusScreenContainer(),
),
));
expect(find.text('Operand A'), findsOneWidget);
expect(find.text('Operand B'), findsNothing);
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment