Skip to content

Commit

Permalink
#73 - refactor(integration-tests): implement user getter for mock ser…
Browse files Browse the repository at this point in the history
…vice
  • Loading branch information
sdresselmann committed May 11, 2024
1 parent 33dd2ad commit bfca820
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
4 changes: 2 additions & 2 deletions integration_test/app_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ void main() {

setUpAll(() {
connectToMockDatabase();
setCurrentUser();
setUserService();
});

group('navigation smoke tests:', () {
Expand All @@ -39,7 +39,7 @@ void main() {
});

testWidgets(
'5. navigate from home to the training plan list page without occurring any errors',
'3. navigate from home to the training plan list page without occurring any errors',
(tester) async {
await startApp(tester);
await navigateToTrainingPlanList(tester);
Expand Down
2 changes: 1 addition & 1 deletion test/app_widget_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ void main() {
TestWidgetsFlutterBinding.ensureInitialized();

connectToMockDatabase();
setCurrentUser();
setUserService();

testWidgets('App smoke test, start the app and see what happens.',
(WidgetTester tester) async {
Expand Down
2 changes: 1 addition & 1 deletion test_utils/helpers/data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ void connectToMockDatabase() {
Get.put<FirestoreService>(MockFirestoreService());
}

void setCurrentUser() {
void setUserService() {
Get.put<UserService>(UserMockService());
}
5 changes: 5 additions & 0 deletions test_utils/mocks/user_mock_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,9 @@ import '../given.dart';
class UserMockService extends GetxService with Mock implements UserService {
@override
late final Future<AppUser> user$ = Future.value(Given().getAppUser());

@override
AppUser get user {
return Given().getAppUser();
}
}
7 changes: 6 additions & 1 deletion windows/flutter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ include(${EPHEMERAL_DIR}/generated_config.cmake)
# https://github.com/flutter/flutter/issues/57146.
set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper")

# Set fallback configurations for older versions of the flutter tool.
if (NOT DEFINED FLUTTER_TARGET_PLATFORM)
set(FLUTTER_TARGET_PLATFORM "windows-x64")
endif()

# === Flutter Library ===
set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll")

Expand Down Expand Up @@ -92,7 +97,7 @@ add_custom_command(
COMMAND ${CMAKE_COMMAND} -E env
${FLUTTER_TOOL_ENVIRONMENT}
"${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat"
windows-x64 $<CONFIG>
${FLUTTER_TARGET_PLATFORM} $<CONFIG>
VERBATIM
)
add_custom_target(flutter_assemble DEPENDS
Expand Down

0 comments on commit bfca820

Please sign in to comment.