Skip to content

Commit 41b17ab

Browse files
committed
feat(tests): add test for generating signed URLs in responsive image attributes
1 parent 3cf2616 commit 41b17ab

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

test/imagekit/custom-tests/responsive_image_attributes_test.rb

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,4 +281,26 @@ def test_fallback_when_no_usable_vw_tokens
281281

282282
assert_equal(expected, result.to_h)
283283
end
284+
285+
# Test to verify signed URLs work correctly in responsive image attributes
286+
def test_should_generate_signed_urls_in_srcset
287+
result = @client.helper.get_responsive_image_attributes(
288+
{
289+
src: "sdk-testing-files/future-search.png",
290+
url_endpoint: "https://ik.imagekit.io/demo",
291+
device_breakpoints: [640, 1280],
292+
image_breakpoints: [],
293+
signed: true
294+
}
295+
)
296+
297+
expected = {
298+
src: "https://ik.imagekit.io/demo/sdk-testing-files/future-search.png?tr=w-1280,c-at_max&ik-s=cce0258e8b27bee5d4b642bcee996c5fac11a907",
299+
src_set: "https://ik.imagekit.io/demo/sdk-testing-files/future-search.png?tr=w-640,c-at_max&ik-s=d326eadc97c62b0896dc1bb872355a47c8b71943 640w, https://ik.imagekit.io/demo/sdk-testing-files/future-search.png?tr=w-1280,c-at_max&ik-s=cce0258e8b27bee5d4b642bcee996c5fac11a907 1280w",
300+
sizes: "100vw",
301+
width: nil
302+
}
303+
304+
assert_equal(expected, result.to_h)
305+
end
284306
end

0 commit comments

Comments
 (0)