Fakultas Ilmu Komputer UI

Commit 7cea511b authored by Putri Salsabila's avatar Putri Salsabila
Browse files

Fixing conflict

parents 15d315d3 fd26348b
......@@ -6,4 +6,9 @@
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.CAMERA"/>
<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-permission android:name="android.permission.MANAGE_DOCUMENTS" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
</manifest>
......@@ -8,7 +8,13 @@
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.CAMERA"/>
<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-permission android:name="android.permission.MANAGE_DOCUMENTS" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application
android:requestLegacyExternalStorage="true"
android:name="io.flutter.app.FlutterApplication"
android:label="bisaGo"
android:icon="@mipmap/launcher_icon">
......
......@@ -6,4 +6,9 @@
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.CAMERA"/>
<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-permission android:name="android.permission.MANAGE_DOCUMENTS" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
</manifest>
......@@ -36,9 +36,9 @@ class KegiatanBloc {
}
Future<dynamic> addNewKegiatan(
Map<String, dynamic> newKegiatanData, String placeId) async {
Map<String, dynamic> newKegiatanData) async {
try {
return await _kegiatanRepository.createKegiatan(newKegiatanData, placeId);
return await _kegiatanRepository.createKegiatan(newKegiatanData);
} catch (e) {
return Response('Failed to register komentar', 400);
}
......
This diff is collapsed.
......@@ -6,7 +6,7 @@ abstract class BaseKegiatanRepository {
Future<KegiatanList> fetchKegiatan(String placeId);
Future<List<String>> fetchImages(String placeId, int id);
Future<dynamic> createKegiatan(
Map<String, dynamic> newKegiatanData, String placeId);
Map<String, dynamic> newKegiatanData);
Future<KegiatanModel> fetchDetailKegiatan(String placeId, int kegiatanId);
}
......@@ -47,10 +47,9 @@ class KegiatanRepository implements BaseKegiatanRepository {
@override
Future<dynamic> createKegiatan(
Map<String, dynamic> newKegiatanData,
String placeId,
) async {
final response = await _network.post(
url: '/informasi-fasilitas/lokasi/add-kegiatan/$placeId/',
url: '/informasi-fasilitas/lokasi/add-kegiatan/${newKegiatanData['place_id']}/',
bodyParams: newKegiatanData,
);
return response;
......
......@@ -60,6 +60,7 @@ dependencies:
photo_view: ^0.11.1
multi_image_picker: ^4.8.1
permission_handler: ^5.1.0+2
http_parser: ^3.1.4
dev_dependencies:
flutter_test:
......
import 'dart:async';
import 'package:bisaGo/model/kegiatan.dart';
import 'package:bisaGo/model/lokasi.dart';
import 'package:bisaGo/page/filter_fasilitas/add_kegiatan.dart';
import 'package:bisaGo/page/filter_fasilitas/fasilitas.dart';
import 'package:bisaGo/repository/kegiatan_repository.dart';
import 'package:bisaGo/repository/komentar_posting_repository.dart';
import 'package:bisaGo/repository/komentar_repository.dart';
import 'package:bisaGo/repository/lokasi_repository.dart';
import 'package:bisaGo/utils/custom_text_field.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:get_it/get_it.dart';
import 'package:mockito/mockito.dart';
import 'package:network_image_mock/network_image_mock.dart';
class MockKomentarRepository extends Fake implements KomentarRepository {}
class MockLokasiRepository extends Fake implements LokasiRepository {
final mockLokasi = {
'placeId': 'lKHBIUnKLJnKjnKLN',
'name': 'Margo City',
'alamat':
'Jl. Margonda Raya No.358, Kemiri Muka, Kecamatan Beji, Kota Depok, Jawa Barat 16423',
'image': 'static/img/2669211407.jpg',
'no_telp': '02178870888',
'counter': 69,
};
@override
Future<LokasiListResponse> fetchLokasi() async {
return Future.value(LokasiListResponse([Lokasi.fromJson(mockLokasi)]));
}
}
class MockKomentarPostingRepository extends Fake
implements KomentarPostingRepository {}
class MockKegiatanRepository extends Fake implements KegiatanRepository {
final mockKegiatan = {
'id': 1,
'place_id': 'asdfghjkl',
'creator': 'Jovi',
'nama_kegiatan': 'Jalan Sehat',
'penyelenggara': 'Gubernur',
'narahubung': 'Rafif (088012341234)',
'deskripsi': 'Jalan sehat keliling kota',
'time_start': '16-05-2021 06:00:00',
'time_end': '',
'image': '',
};
@override
Future<KegiatanList> fetchKegiatan(String placeId) {
return Future.value(KegiatanList([KegiatanModel.fromJson(mockKegiatan)]));
}
}
void main() {
final mockLokasi = {
'name': 'Margo City',
'alamat':
'Jl. Margonda Raya No.358, Kemiri Muka, Kecamatan Beji, Kota Depok, Jawa Barat 16423',
'image': 'static/img/2669211407.jpg',
'no_telp': '02178870888',
'counter': 69,
};
final mockKegiatan = {
'id': 1,
'place_id': 'asdfghjkl',
'creator': 'Jovi',
'nama_kegiatan': 'Jalan Sehat',
'penyelenggara': 'Gubernur',
'narahubung': 'Rafif (0880123456123456)',
'deskripsi': 'Jalan sehat keliling kota',
'time_start': '2021-05-15 06:00:00',
'time_end': '2021-05-15 10:00:00',
'image': ['a', 'b', 'c'],
};
setUpAll(() {
final _getIt = GetIt.instance;
_getIt.registerLazySingleton<BaseKomentarRepository>(
() => MockKomentarRepository());
_getIt.registerLazySingleton<BaseKomentarPostingRepository>(
() => MockKomentarPostingRepository());
_getIt.registerLazySingleton<BaseLokasiRepository>(
() => MockLokasiRepository());
_getIt.registerLazySingleton<BaseKegiatanRepository>(
() => MockKegiatanRepository());
});
testWidgets('Test Tambah Kegiatan Page',
(WidgetTester tester) async {
await mockNetworkImagesFor(() => tester.pumpWidget(
MaterialApp(
home: Fasilitas(
lokasi: Lokasi.fromJson(mockLokasi),
kegiatan: KegiatanModel.fromJson(mockKegiatan),
)
)
));
await tester.pump();
expect(find.text('Margo City'), findsOneWidget);
expect(find.text('Kegiatan'), findsOneWidget);
await tester.drag(find.text('Tambah Informasi'), Offset(-500, 0));
await tester.pump();
await tester.tap(find.text('Tambah Kegiatan'));
await tester.pump();
}
);
testWidgets('Test Form Tambah Kegiatan',
(WidgetTester tester) async {
await mockNetworkImagesFor(
() => tester.pumpWidget(
StatefulBuilder(
builder: (BuildContext context, StateSetter setState) {
return MaterialApp(
home: Material(
child: AddKegiatan(nama: 'Margo City', placeId: 'asdfghjkl'),
)
);
},
)
)
);
expect(find.byType(CustomTextField), findsWidgets);
expect(find.byType(ElevatedButton), findsOneWidget);
}
);
}
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