Exemplo n.º 1
0
 it("takes an image response with options (just one dimension) and resizes it to fit", () => {
   expect(resizedImageUrl(image, { width: 500 })).toEqual({
     factor: 0.14285714285714285,
     height: 333,
     width: 500,
     url: "https://gemini.cloudfront.test/?resize_to=fit&width=500&height=333&quality=95&src=https%3A%2F%2Fxxx.cloudfront.net%2Fxxx%2Flarge.jpg", // eslint-disable-line
   })
 })
Exemplo n.º 2
0
 it("returns a resized image URL when existing image dimensions are lacking", () => {
   expect(
     resizedImageUrl(
       {
         image_url: "https://xxx.cloudfront.net/xxx/:version.jpg",
         image_versions: ["large"],
       },
       {
         width: 500,
         height: 500,
       }
     )
   ).toEqual({
     factor: Infinity,
     width: null,
     height: null,
     url: "https://gemini.cloudfront.test/?resize_to=fit&width=500&height=500&quality=95&src=https%3A%2F%2Fxxx.cloudfront.net%2Fxxx%2Flarge.jpg", // eslint-disable-line
   })
 })