Skip to content

Commit

Permalink
fix: Fix ProductsAPITest (#5267)
Browse files Browse the repository at this point in the history
  • Loading branch information
g123k authored Aug 7, 2024
1 parent 8163308 commit fb837b7
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ import openfoodfacts.github.scrachx.openfood.models.entities.SendProduct
import openfoodfacts.github.scrachx.openfood.network.ProductsAPITest.SearchSubject.Companion.assertThat
import openfoodfacts.github.scrachx.openfood.network.services.ProductsAPI
import openfoodfacts.github.scrachx.openfood.utils.getUserAgent
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.BeforeAll
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.assertThrows
import retrofit2.Retrofit
import retrofit2.converter.jackson.JacksonConverterFactory
import retrofit2.create
Expand Down Expand Up @@ -111,10 +113,11 @@ class ProductsAPITest {
assertThat(search).hasFoundProducts()
}

@ExperimentalCoroutinesApi
@Test
fun `products by city paris not found`() = runBlocking {
val response = prodClient.getProductsByCity("paris")
assertThat(response).hasFoundNoProducts()
val exception = assertThrows<Exception> { prodClient.getProductsByCity("paris") }
Assertions.assertEquals("HTTP 404", exception.message?.trim())
}

@ExperimentalCoroutinesApi
Expand All @@ -127,7 +130,7 @@ class ProductsAPITest {

@Test
fun `product not found`() = runBlocking {
val barcode = "457457457"
val barcode = "457457457457"
val state = prodClient.getProductByBarcode(
barcode,
"code",
Expand Down

0 comments on commit fb837b7

Please sign in to comment.