Skip to content

Commit

Permalink
Add origin_country to movie details
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisKruegerDev committed Nov 15, 2024
1 parent b2b3caa commit 41013d2
Show file tree
Hide file tree
Showing 3 changed files with 9,465 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,30 +91,31 @@ data class TmdbMoviePageResult(

@Serializable
data class TmdbMovieDetail(
val adult: Boolean,
@SerialName("adult") val adult: Boolean,
@SerialName("backdrop_path") val backdropPath: String?,
val budget: Long,
@SerialName("budget") val budget: Long,
@SerialName("genres") val genres: List<TmdbGenre>,
val homepage: String? = null,
val id: Int,
@SerialName("homepage") val homepage: String? = null,
@SerialName("id")val id: Int,
@SerialName("imdb_id") val imdbId: String? = null,
val title: String,
val runtime: Int? = null,
@SerialName("origin_country") val originCountry: List<String> = emptyList(),
@SerialName("title") val title: String,
@SerialName("runtime") val runtime: Int? = null,
@SerialName("original_title") val originalTitle: String,
@SerialName("original_language") val originalLanguage: String,
val overview: String,
@SerialName("overview") val overview: String,
@SerialName("poster_path") val posterPath: String?,
@SerialName("vote_average") override val voteAverage: Float,
@SerialName("vote_count") override val voteCount: Int,
@SerialName("external_ids") val externalIds: TmdbExternalIds? = null,
val status: TmdbMovieStatus,
val tagline: String,
val video: Boolean,
val popularity: Float,
@SerialName("status") val status: TmdbMovieStatus,
@SerialName("tagline") val tagline: String,
@SerialName("video") val video: Boolean,
@SerialName("popularity") val popularity: Float,
@SerialName("release_date")
@Serializable(LocalDateSerializer::class)
val releaseDate: LocalDate?,
val revenue: Long,
@SerialName("revenue") val revenue: Long,
@SerialName("release_dates") val releaseDates: TmdbResult<TmdbReleaseDates>? = null,
@SerialName("production_companies") val productionCompanies: List<TmdbCompany>? = null,
@SerialName("production_countries") val productionCountries: List<TmdbCountry>? = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@

package app.moviebase.tmdb.api

import app.moviebase.tmdb.core.mockHttpClient
import app.moviebase.tmdb.model.AppendResponse
import app.moviebase.tmdb.model.TmdbReleaseType
import app.moviebase.tmdb.model.TmdbVideoType
import app.moviebase.tmdb.model.getCertification
import app.moviebase.tmdb.model.getReleaseDateBy
import app.moviebase.tmdb.model.getReleaseDatesBy
import app.moviebase.tmdb.core.mockHttpClient
import com.google.common.truth.Truth.assertThat
import kotlin.test.assertNotNull
import kotlinx.coroutines.test.runTest
import kotlinx.datetime.toInstant
import org.junit.jupiter.api.Test
Expand All @@ -28,6 +27,8 @@ class TmdbMoviesApiTest {
to "movie/movie_details_607.json",
"movie/526896?language=en-US&append_to_response=release_dates"
to "movie/movie_images_526896.json",
"movie/37799?language=en-US"
to "movie/movie_details_37799.json",
"movie/popular?page=1&language=en-US"
to "movie/movie_popular.json",
)
Expand Down Expand Up @@ -136,4 +137,15 @@ class TmdbMoviesApiTest {
assertThat(popular.results).isNotEmpty()
assertThat(popular.page).isEqualTo(1)
}

@Test
fun `it has the origin country`() = runTest {
val movieDetails = classToTest.getDetails(
movieId = 37799,
language = "en-US",
)

assertThat(movieDetails.originCountry.size).isEqualTo(1)
assertThat(movieDetails.originCountry.first()).isEqualTo("US")
}
}
Loading

0 comments on commit 41013d2

Please sign in to comment.