Skip to content

Commit

Permalink
Code cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
nowakweronika committed May 9, 2024
1 parent f17b38f commit 6f06ca4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,17 @@ import com.appunite.loudius.ui.reviewers.ReviewersScreen
import com.appunite.loudius.util.IntegrationTestRule
import com.appunite.loudius.util.Register
import com.appunite.loudius.util.waitUntilLoadingDoesNotExist
import com.appunite.mockwebserver_assertions.path
import com.appunite.mockwebserver_assertions.url
import com.appunite.mockwebserverextensions.MockWebServerRule
import okhttp3.mockwebserver.MockResponse
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.koin.compose.KoinContext
import strikt.api.expectThat
import strikt.assertions.containsExactly
import strikt.assertions.isEqualTo

abstract class AbsReviewersScreenTest {

Expand Down Expand Up @@ -111,7 +115,14 @@ abstract class AbsReviewersScreenTest {
@Test
fun whenClickOnNotifyAndDoNotCommentThenShowError() {
with(integrationTestRule) {
Register.set404Error(mockWebServer)
mockWebServer.register {
expectThat(it).url.and {
get("host") { host }.isEqualTo("api.github.com")
path.isEqualTo("/repos/exampleOwner/exampleRepo/issues/1/comments")
}

MockResponse().setResponseCode(404)
}

composeTestRule.setContent {
KoinContext {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import com.appunite.mockwebserver_assertions.queryParameter
import com.appunite.mockwebserver_assertions.url
import com.appunite.mockwebserverextensions.MockWebServerRule
import com.appunite.mockwebserverextensions.util.jsonResponse
import okhttp3.mockwebserver.MockResponse
import strikt.api.expectThat
import strikt.assertions.isEqualTo

Expand Down Expand Up @@ -103,17 +102,6 @@ object Register {
}
}

fun set404Error(mockWebServer: MockWebServerRule) {
mockWebServer.register {
expectThat(it).url.and {
get("host") { host }.isEqualTo("api.github.com")
path.isEqualTo("/repos/exampleOwner/exampleRepo/issues/1/comments")
}

MockResponse().setResponseCode(404)
}
}

fun requestedReviewers(mockWebServer: MockWebServerRule) {
mockWebServer.register {
expectThat(it).url.and {
Expand Down

0 comments on commit 6f06ca4

Please sign in to comment.