File tree 1 file changed +17
-0
lines changed
app/src/test/kotlin/app/fyreplace/fyreplace/test/screens
1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -86,11 +86,28 @@ class RegisterViewModelTests : TestsBase() {
86
86
viewModel.updateEmail(" email" )
87
87
runCurrent()
88
88
assertFalse(viewModel.canSubmit.value)
89
+
89
90
viewModel.updateEmail(" email@example" )
90
91
runCurrent()
91
92
assertTrue(viewModel.canSubmit.value)
92
93
}
93
94
95
+ @Test
96
+ fun `Terms must be accepted` () = runTest {
97
+ val (_, _, viewModel) = makeViewModel(FakeEventBus ())
98
+ viewModel.updateUsername(FakeUsersEndpointApi .GOOD_USERNAME )
99
+ viewModel.updateEmail(FakeUsersEndpointApi .GOOD_EMAIL )
100
+ backgroundScope.launch { viewModel.canSubmit.collect() }
101
+
102
+ viewModel.updateHasAcceptedTerms(false )
103
+ runCurrent()
104
+ assertFalse(viewModel.canSubmit.value)
105
+
106
+ viewModel.updateHasAcceptedTerms(true )
107
+ runCurrent()
108
+ assertTrue(viewModel.canSubmit.value)
109
+ }
110
+
94
111
@Test
95
112
fun `Invalid username produces a failure` () = runTest {
96
113
val eventBus = FakeEventBus ()
You can’t perform that action at this time.
0 commit comments