This file contains hidden or 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
clickEvent = { quiz -> | |
val route = ScreenRoutes.quizRoute(quiz) | |
navController.navigate(route) | |
} |
This file contains hidden or 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
fun quizRoute(quiz: Quiz): String{ | |
val json = Uri.encode(Gson().toJson(quiz)) | |
return "$QUIZ_ROUTE/$json" | |
} |
This file contains hidden or 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
object ScreenRoutes { | |
const val ON_BOARDING_ROUTE = "Simplemath_Onboarding" | |
const val ON_BOARDING_WELCOME_NAVO_MESSAGE_ROUTE = "Simplemath_Onboarding_Welcome_Navo_Message" | |
const val ON_BOARDING_USER_NAME_STEP_ROUTE = "Simplemath_Onboarding_UserNameStep" | |
const val ON_BOARDING_USER_AGE_STEP_ROUTE = "Simplemath_Onboarding_UserAgeStep" | |
const val ON_BOARDING_USER_EMAIL_STEP_ROUTE = "Simplemath_Onboarding_UserEmailStep" | |
const val ON_BOARDING_WELCOME_USER_STEP_ROUTE = "Simplemath_Onboarding_WelcomeUserStep" | |
const val DASHBOARD_ROUTE = "Simplemath_Dashboard" |
This file contains hidden or 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
// string | |
Truth.assertThat(result).isEqualTo("my string") | |
// list | |
Truth.assertThat(result).isEmpty() | |
// custom object | |
Truth.assertThat(uiBase).isEqualTo( | |
UIBaseState.Error("Invalid e-mail") | |
) |
This file contains hidden or 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
@Test | |
fun `user email - already exists a user email`() { | |
// arrange | |
every { localRepository.userEmail() }.returns("[email protected]") | |
val viewModel = UserEmailStepViewModel(localRepository) | |
// act | |
val result = viewModel.userEmail | |
// assert |
This file contains hidden or 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
private val localRepository = mockk<LocalRepository>() | |
@Test | |
fun `user name - already exists a user name`() { | |
every { localRepository.userName() }.returns("Moro") | |
val viewModel = UserNameStepViewModel(localRepository) | |
val result = viewModel.userName | |
Truth.assertThat(result).isEqualTo("Moro") |
This file contains hidden or 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
private ResultProfileBinding binding; | |
@Override | |
public View onCreateView (LayoutInflater inflater, | |
ViewGroup container, | |
Bundle savedInstanceState) { | |
binding = ResultProfileBinding.inflate(inflater, container, false); | |
View view = binding.getRoot(); | |
return view; | |
} |
This file contains hidden or 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
fun showMessage(context: Context, val idRes: Int) { | |
Toast.makeText(context, idRes, Toast.SHORT_LENGHT).show() | |
} |