Skip to content

Commit

Permalink
Add test to verify filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
gunnarvelle committed Dec 20, 2023
1 parent bc565ec commit de73014
Showing 1 changed file with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ class ImageSearchServiceTest

val largeImage: ImageFileData = ImageFileData(1, "large-full-url", 10000, "jpg", None, "und", 4)
val smallImage: ImageFileData = ImageFileData(2, "small-full-url", 100, "jpg", None, "und", 6)
val podcastImage: ImageFileData =
ImageFileData(3, "podcast-full-url", 100, "jpg", Some(ImageDimensions(width = 1400, height = 1400)), "und", 6)

val byNcSa: Copyright = Copyright(
CC_BY_NC_SA.toString,
Expand Down Expand Up @@ -157,7 +159,7 @@ class ImageSearchServiceTest
ImageTitle("Nynoreg", "nn")
),
alttexts = Seq(ImageAltText("urelatert alttext", "und"), ImageAltText("Nynoreg", "nn")),
images = Seq(smallImage),
images = Seq(podcastImage),
copyright = byNcSa,
tags = Seq(),
captions = Seq(),
Expand Down Expand Up @@ -628,4 +630,16 @@ class ImageSearchServiceTest
searchResult2.results.head.title.title should equal("This is a unrelated photo")
searchResult2.results.head.title.language should equal("en")
}

test("That filtering for podcast-friendly works as expected") {
val Success(searchResult1) = imageSearchService.matchingQuery(
searchSettings.copy(
language = "*",
podcastFriendly = Some(true)
),
None
)

searchResult1.results.map(_.id) should be(Seq("5"))
}
}

0 comments on commit de73014

Please sign in to comment.