mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-25 11:45:59 +00:00
Progress bar widget test and clean node_options test
This commit is contained in:
parent
d22746be52
commit
ffc1b19495
2 changed files with 92 additions and 0 deletions
|
@ -151,4 +151,63 @@ void main() {
|
||||||
arguments: const Tuple3(Coin.bitcoin, "node id", "coinNodes")))
|
arguments: const Tuple3(Coin.bitcoin, "node id", "coinNodes")))
|
||||||
.called(1);
|
.called(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
testWidgets("Connect tap", (tester) async {
|
||||||
|
final mockWallets = MockWallets();
|
||||||
|
final mockPrefs = MockPrefs();
|
||||||
|
final mockNodeService = MockNodeService();
|
||||||
|
|
||||||
|
when(mockNodeService.getNodeById(id: "node id")).thenAnswer(
|
||||||
|
(realInvocation) => NodeModel(
|
||||||
|
host: "127.0.0.1",
|
||||||
|
port: 2000,
|
||||||
|
name: "Stack Default",
|
||||||
|
id: "node id",
|
||||||
|
useSSL: true,
|
||||||
|
enabled: true,
|
||||||
|
coinName: "Bitcoin",
|
||||||
|
isFailover: false,
|
||||||
|
isDown: false));
|
||||||
|
|
||||||
|
when(mockNodeService.getPrimaryNodeFor(coin: Coin.bitcoin)).thenAnswer(
|
||||||
|
(realInvocation) => NodeModel(
|
||||||
|
host: "127.0.0.1",
|
||||||
|
port: 2000,
|
||||||
|
name: "Some other node name",
|
||||||
|
id: "some node id",
|
||||||
|
useSSL: true,
|
||||||
|
enabled: true,
|
||||||
|
coinName: "Bitcoin",
|
||||||
|
isFailover: false,
|
||||||
|
isDown: false));
|
||||||
|
|
||||||
|
await tester.pumpWidget(
|
||||||
|
ProviderScope(
|
||||||
|
overrides: [
|
||||||
|
walletsChangeNotifierProvider.overrideWithValue(mockWallets),
|
||||||
|
prefsChangeNotifierProvider.overrideWithValue(mockPrefs),
|
||||||
|
nodeServiceChangeNotifierProvider.overrideWithValue(mockNodeService)
|
||||||
|
],
|
||||||
|
child: MaterialApp(
|
||||||
|
theme: ThemeData(
|
||||||
|
extensions: [
|
||||||
|
StackColors.fromStackColorTheme(
|
||||||
|
LightColors(),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
home: const NodeOptionsSheet(
|
||||||
|
nodeId: "node id", coin: Coin.bitcoin, popBackToRoute: ""),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
expect(find.text("Node options"), findsOneWidget);
|
||||||
|
// expect(find.text("Stack Default"), findsOneWidget);
|
||||||
|
expect(find.text("Disconnected"), findsOneWidget);
|
||||||
|
|
||||||
|
await tester.tap(find.text("Connect"));
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
33
test/widget_tests/progress_bar_test.dart
Normal file
33
test/widget_tests/progress_bar_test.dart
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
import 'package:stackwallet/utilities/theme/light_colors.dart';
|
||||||
|
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||||
|
import 'package:stackwallet/widgets/progress_bar.dart';
|
||||||
|
// import 'package:stackwallet/widgets/animated_text.dart';
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
testWidgets("Widget build", (widgetTester) async {
|
||||||
|
await widgetTester.pumpWidget(
|
||||||
|
MaterialApp(
|
||||||
|
theme: ThemeData(
|
||||||
|
extensions: [
|
||||||
|
StackColors.fromStackColorTheme(LightColors()),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
home: Material(
|
||||||
|
child: ProgressBar(
|
||||||
|
width: 20,
|
||||||
|
height: 10,
|
||||||
|
fillColor:
|
||||||
|
StackColors.fromStackColorTheme(LightColors()).accentColorRed,
|
||||||
|
backgroundColor: StackColors.fromStackColorTheme(LightColors())
|
||||||
|
.accentColorYellow,
|
||||||
|
percent: 30),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
// expect(find.text("Calculating"), findsOneWidget);
|
||||||
|
expect(find.byType(ProgressBar), findsOneWidget);
|
||||||
|
});
|
||||||
|
}
|
Loading…
Reference in a new issue