Fakultas Ilmu Komputer UI

Commit 7ab25d75 authored by Ardian Ghifari's avatar Ardian Ghifari
Browse files

[RED] Add tests

parent 05159b46
import 'package:bisaGo/model/lokasi.dart';
import 'package:flutter/material.dart';
// import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:bisaGo/config/strings.dart';
import 'package:bisaGo/model/komentar.dart';
import 'package:bisaGo/model/user.dart';
// import 'package:bisaGo/model/user.dart';
import 'package:bisaGo/page/filter_fasilitas/postingan/detail_post.dart';
// import 'package:bisaGo/page/profile/profile.dart';
import 'package:get_it/get_it.dart';
// import 'package:get_it/get_it.dart';
import 'package:mockito/mockito.dart';
import 'package:bisaGo/repository/komentar_posting_repository.dart';
import 'package:bisaGo/repository/user_repository.dart';
......@@ -15,25 +15,25 @@ import 'package:shared_preferences/shared_preferences.dart';
class MockKomentarPostingRepository extends Fake
implements KomentarPostingRepository {}
class MockUserRepository extends Fake implements UserRepository {
final userData = {
'is_login': true,
'username': 'ardianghi@gmail.com',
'name': 'Ardian Ghifari',
'email': 'ardianghi@gmail.com',
'tanggal_lahir': '1999-01-01',
'phone_number': '08581190000',
'jenis_kelamin': 'Laki-Laki',
'disabilitas': 'Tidak memiliki disabilitas',
'pekerjaan': 'Pelajar',
'alamat': 'Tidak Tahu'
};
// class MockUserRepository extends Fake implements UserRepository {
// final userData = {
// 'is_login': true,
// 'username': 'ardianghi@gmail.com',
// 'name': 'Ardian Ghifari',
// 'email': 'ardianghi@gmail.com',
// 'tanggal_lahir': '1999-01-01',
// 'phone_number': '08581190000',
// 'jenis_kelamin': 'Laki-Laki',
// 'disabilitas': 'Tidak memiliki disabilitas',
// 'pekerjaan': 'Pelajar',
// 'alamat': 'Tidak Tahu'
// };
@override
Future<User> fetchUserDetail(String email) async {
return Future.value(User([UserModel.fromJson(userData)]));
}
}
// @override
// Future<User> fetchUserDetail(String email) async {
// return Future.value(User([UserModel.fromJson(userData)]));
// }
// }
void main() {
const mockFasilitas = {
......
......@@ -9,6 +9,7 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:bisaGo/network/network_interface.dart';
import 'package:bisaGo/page/dashboard/dashboard.dart';
import 'package:http/http.dart' as http;
import 'package:shimmer/shimmer.dart';
class MockNavigatorObserver extends Mock implements NavigatorObserver {}
......@@ -107,6 +108,12 @@ void main() {
await tester.pump();
}
// testWidgets('Shimmer loading exists - Positive',
// (WidgetTester tester) async {
// await tester.pumpWidget(MaterialApp(home: Dashboard()));
// expect(find.byKey(Key('Shimmer loading')), findsOneWidget);
// });
testWidgets(
'when tapping text form field, should navigate to pencarian page',
(WidgetTester tester) async {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment