From 8f6753e7d71b5dff33e0dd05863d212d57d9d11c Mon Sep 17 00:00:00 2001 From: Georges Lebreton <102960844+Georges-GNM@users.noreply.github.com> Date: Tue, 12 Nov 2024 16:54:04 +0000 Subject: [PATCH] Update tests --- .../gu/facia/api/models/FaciaImageCutoutTest.scala | 14 +++++++------- .../facia/api/models/FaciaImageReplaceTest.scala | 6 +++--- .../facia/api/models/FaciaImageSlideshowTest.scala | 8 ++++---- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/fapi-client/src/test/scala/com/gu/facia/api/models/FaciaImageCutoutTest.scala b/fapi-client/src/test/scala/com/gu/facia/api/models/FaciaImageCutoutTest.scala index c2a31f54..7ed18bda 100644 --- a/fapi-client/src/test/scala/com/gu/facia/api/models/FaciaImageCutoutTest.scala +++ b/fapi-client/src/test/scala/com/gu/facia/api/models/FaciaImageCutoutTest.scala @@ -37,7 +37,7 @@ class FaciaImageCutoutTest extends AnyFreeSpec with Matchers with TestContent { "should return None for imageCutoutReplace=true but nothing to replace with" in { val trailMeta = trailMetaDataWithImageCutout(true) val resolvedMetaData = ResolvedMetaData.fromTrailMetaData(trailMeta) - val imageCutout = FaciaImage.getFaciaImage(Some(emptyContent), trailMeta, resolvedMetaData) + val imageCutout = FaciaImage.getFaciaImage(Some(emptyContent), trailMeta, resolvedMetaData, None) imageCutout should be (None) } @@ -48,13 +48,13 @@ class FaciaImageCutoutTest extends AnyFreeSpec with Matchers with TestContent { val trailMetaTrue = trailMetaDataWithImageCutout(true, Option(src), width, height) val resolvedMetaDataTrue = ResolvedMetaData.fromTrailMetaData(trailMetaTrue) - val imageCutoutTrue = FaciaImage.getFaciaImage(Some(emptyContent), trailMetaTrue, resolvedMetaDataTrue) + val imageCutoutTrue = FaciaImage.getFaciaImage(Some(emptyContent), trailMetaTrue, resolvedMetaDataTrue, None) imageCutoutTrue.isDefined should be (true) imageCutoutTrue should be (Some(Cutout(src, width, height))) val trailMetaFalse = trailMetaDataWithImageCutout(false, Option(src), width, height) val resolvedMetaDataFalse = ResolvedMetaData.fromTrailMetaData(trailMetaFalse) - val imageCutoutFalse = FaciaImage.getFaciaImage(Some(emptyContent), trailMetaFalse, resolvedMetaDataFalse) + val imageCutoutFalse = FaciaImage.getFaciaImage(Some(emptyContent), trailMetaFalse, resolvedMetaDataFalse, None) imageCutoutFalse should be (None) } @@ -65,21 +65,21 @@ class FaciaImageCutoutTest extends AnyFreeSpec with Matchers with TestContent { val trailMeta = trailMetaDataWithImageCutout(true, src, widthNone, height) val resolvedMetaData = ResolvedMetaData.fromTrailMetaData(trailMeta) - val imageCutout = FaciaImage.getFaciaImage(Some(emptyContent), trailMeta, resolvedMetaData) + val imageCutout = FaciaImage.getFaciaImage(Some(emptyContent), trailMeta, resolvedMetaData, None) imageCutout should be (None) } "should return an Image of type cutout from content tags" in { val trailMeta = trailMetaDataWithImageCutout(true, None, None, None) val resolvedMetaData = ResolvedMetaData.fromTrailMetaData(trailMeta) - val imageCutout = FaciaImage.getFaciaImage(Some(contentWithContributor), trailMeta, resolvedMetaData) + val imageCutout = FaciaImage.getFaciaImage(Some(contentWithContributor), trailMeta, resolvedMetaData, None) imageCutout should be (Some(Cutout(bylineImageUrl, None, None))) } "should not return an Image of type cutout from content tags if imageCutoutReplace is false" in { val trailMeta = trailMetaDataWithImageCutout(false, None, None, None) val resolvedMetaData = ResolvedMetaData.fromTrailMetaData(trailMeta) - val imageCutout = FaciaImage.getFaciaImage(Some(contentWithContributor), trailMeta, resolvedMetaData) + val imageCutout = FaciaImage.getFaciaImage(Some(contentWithContributor), trailMeta, resolvedMetaData, None) imageCutout should be (None) } @@ -90,7 +90,7 @@ class FaciaImageCutoutTest extends AnyFreeSpec with Matchers with TestContent { val trailMeta = trailMetaDataWithImageCutout(true, src, width, height) val resolvedMetaData = ResolvedMetaData.fromTrailMetaData(trailMeta) - val imageCutout = FaciaImage.getFaciaImage(None, trailMeta, resolvedMetaData) + val imageCutout = FaciaImage.getFaciaImage(None, trailMeta, resolvedMetaData, None) imageCutout should be (Some(Cutout("src", width, height))) } } diff --git a/fapi-client/src/test/scala/com/gu/facia/api/models/FaciaImageReplaceTest.scala b/fapi-client/src/test/scala/com/gu/facia/api/models/FaciaImageReplaceTest.scala index a1675c1d..3c17a457 100644 --- a/fapi-client/src/test/scala/com/gu/facia/api/models/FaciaImageReplaceTest.scala +++ b/fapi-client/src/test/scala/com/gu/facia/api/models/FaciaImageReplaceTest.scala @@ -40,16 +40,16 @@ class FaciaImageReplaceTest extends AnyFlatSpec with Matchers { "Image" should "give an Image of type default when it is not set" in { val resolvedMetaData = ResolvedMetaData.fromTrailMetaData(trailMetaDataWithoutImageReplace) - FaciaImage.getFaciaImage(None, trailMetaDataWithoutImageReplace, resolvedMetaData) should be (None) + FaciaImage.getFaciaImage(None, trailMetaDataWithoutImageReplace, resolvedMetaData, None) should be (None) } it should "give back an Image when true" in { val resolvedMetaData = ResolvedMetaData.fromTrailMetaData(trailMetaDataWithImageReplace) - FaciaImage.getFaciaImage(None, trailMetaDataWithImageReplace, resolvedMetaData) should be (Some(Replace("theImageSrc", "theImageSrcWidth", "theImageSrcHeight", None))) + FaciaImage.getFaciaImage(None, trailMetaDataWithImageReplace, resolvedMetaData, None) should be (Some(Replace("theImageSrc", "theImageSrcWidth", "theImageSrcHeight", None))) } it should "give back an ImageSource when imageSource present in metadata" in { val resolvedMetaData = ResolvedMetaData.fromTrailMetaData(trailMetaDataWithImageSource) - FaciaImage.getFaciaImage(None, trailMetaDataWithImageSource, resolvedMetaData) should be (Some(Replace("theImageSrcAsset", "500", "300", None))) + FaciaImage.getFaciaImage(None, trailMetaDataWithImageSource, resolvedMetaData, None) should be (Some(Replace("theImageSrcAsset", "500", "300", None))) } } diff --git a/fapi-client/src/test/scala/com/gu/facia/api/models/FaciaImageSlideshowTest.scala b/fapi-client/src/test/scala/com/gu/facia/api/models/FaciaImageSlideshowTest.scala index 36c27725..0033ff00 100644 --- a/fapi-client/src/test/scala/com/gu/facia/api/models/FaciaImageSlideshowTest.scala +++ b/fapi-client/src/test/scala/com/gu/facia/api/models/FaciaImageSlideshowTest.scala @@ -51,22 +51,22 @@ class FaciaImageSlideshowTest extends AnyFlatSpec with Matchers { "Image" should "give a None if when imageSlideshowReplace not set" in { val resolvedMetaData = ResolvedMetaData.fromTrailMetaData(trailMetaDataWithoutImageSlideshowReplace) - FaciaImage.getFaciaImage(None, trailMetaDataWithoutImageSlideshowReplace, resolvedMetaData) should be (None) + FaciaImage.getFaciaImage(None, trailMetaDataWithoutImageSlideshowReplace, resolvedMetaData, None) should be (None) } it should "give back an ImageGallery when true" in { val resolvedMetaData = ResolvedMetaData.fromTrailMetaData(trailMetaDataWithImageSlideshowReplace) - FaciaImage.getFaciaImage(None, trailMetaDataWithImageSlideshowReplace, resolvedMetaData) should be (Some(ImageSlideshow(List(Replace("theImageSrcOne", "theImageSrcWidthOne", "theImageSrcHeightOne", None), Replace("theImageSrcTwo", "theImageSrcWidthTwo", "theImageSrcHeightTwo", None), Replace("theImageSrcThree", "theImageSrcWidthThree", "theImageSrcHeightThree", None))))) + FaciaImage.getFaciaImage(None, trailMetaDataWithImageSlideshowReplace, resolvedMetaData, None) should be (Some(ImageSlideshow(List(Replace("theImageSrcOne", "theImageSrcWidthOne", "theImageSrcHeightOne", None), Replace("theImageSrcTwo", "theImageSrcWidthTwo", "theImageSrcHeightTwo", None), Replace("theImageSrcThree", "theImageSrcWidthThree", "theImageSrcHeightThree", None))))) } it should "give back an ImageGallery when true, with caption set on one image" in { val resolvedMetaData = ResolvedMetaData.fromTrailMetaData(trailMetaDataWithImageSlideshowReplaceAndCaptionSetOnOneImage) - FaciaImage.getFaciaImage(None, trailMetaDataWithImageSlideshowReplaceAndCaptionSetOnOneImage, resolvedMetaData) should be (Some(ImageSlideshow(List(Replace("theImageSrcOne", "theImageSrcWidthOne", "theImageSrcHeightOne", None), Replace("theImageSrcTwo", "theImageSrcWidthTwo", "theImageSrcHeightTwo", None), Replace("theImageSrcThree", "theImageSrcWidthThree", "theImageSrcHeightThree", None), Replace("theImageSrcFour", "theImageSrcWidthFour", "theImageSrcHeightFour", Some("exampleCaption")))))) + FaciaImage.getFaciaImage(None, trailMetaDataWithImageSlideshowReplaceAndCaptionSetOnOneImage, resolvedMetaData, None) should be (Some(ImageSlideshow(List(Replace("theImageSrcOne", "theImageSrcWidthOne", "theImageSrcHeightOne", None), Replace("theImageSrcTwo", "theImageSrcWidthTwo", "theImageSrcHeightTwo", None), Replace("theImageSrcThree", "theImageSrcWidthThree", "theImageSrcHeightThree", None), Replace("theImageSrcFour", "theImageSrcWidthFour", "theImageSrcHeightFour", Some("exampleCaption")))))) } it should "give back a None when imageSlideshowReplace true with no assets" in { val resolvedMetaData = ResolvedMetaData.fromTrailMetaData(trailMetaDataWithImageSlideshowReplaceAndNoAssets) - FaciaImage.getFaciaImage(None, trailMetaDataWithImageSlideshowReplaceAndNoAssets, resolvedMetaData) should be (None) + FaciaImage.getFaciaImage(None, trailMetaDataWithImageSlideshowReplaceAndNoAssets, resolvedMetaData, None) should be (None) } }