-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #342 from wakamenod/339-mobile-test-収入詳細uiテスト追加
[Mobile] [Test] 収入詳細UIテスト追加 #339
- Loading branch information
Showing
7 changed files
with
89 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+54.5 KB
...res/transactions/presentations/transaction/income/goldens/new_income_detail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+73.3 KB
.../transactions/presentations/transaction/income/goldens/update_income_detail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
51 changes: 51 additions & 0 deletions
51
...t/src/features/transactions/presentations/transaction/income/income_detail_view_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:golden_toolkit/golden_toolkit.dart'; | ||
import 'package:mocktail/mocktail.dart'; | ||
import 'package:openapi/openapi.dart'; | ||
|
||
import '../../../../../mocks.dart'; | ||
import '../../../transactions_robot.dart'; | ||
|
||
void main() { | ||
// TODO エラー時の表示テスト追加 | ||
|
||
group('IncomeDetailView Golden test group', () { | ||
testGoldens('Open IncomeDetailView as registration for new income', | ||
(tester) async { | ||
await loadAppFonts(); | ||
final r = TransactionsRobot(tester); | ||
final now = DateTime(2023, 5, 1); | ||
await r.pumpIncomeDetailScreen(id: null, now: now); | ||
await screenMatchesGolden(tester, 'new_income_detail'); | ||
}); | ||
}); | ||
|
||
testGoldens('Open IncomeDetailView for updating a registered income', | ||
(tester) async { | ||
await loadAppFonts(); | ||
final r = TransactionsRobot(tester); | ||
final now = DateTime(2023, 5, 1); | ||
final repository = MockIncomeDetailRepository(); | ||
final incomeTypeRepo = MockIncomeTypesRepository(); | ||
const id = 'income_id'; | ||
final incomeType = ModelIncomeType((e) => e | ||
..id = 'income_type_id' | ||
..name = 'Test Income Type'); | ||
final res = IncomeDetailRes((r) => r.income.replace(ModelIncome((b) => b | ||
..id = id | ||
..localDate = '2023-05-03' | ||
..memo = 'some memo' | ||
..amount = 400 | ||
..incomeTypeId = incomeType.id))); | ||
when(() => repository.fetchIncomeDetail(id)) | ||
.thenAnswer((invocation) => Future.value(res)); | ||
when(() => incomeTypeRepo.fetchIncomeTypesList()) | ||
.thenAnswer((invocation) => Future.value([incomeType])); | ||
await r.pumpIncomeDetailScreen( | ||
incomeRepo: repository, | ||
incomeTypeRepo: incomeTypeRepo, | ||
id: id, | ||
now: now); | ||
await screenMatchesGolden(tester, 'update_income_detail'); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters