-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #318 from onaio/changes-to-work-with-thumbor-7.5.0
Refactor thumbor URL to fix compatibility with thumbor 7.5.0
- Loading branch information
Showing
2 changed files
with
30 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,27 @@ | ||
(ns milia.utils.images-test | ||
#_{:clj-kondo/ignore [:refer-all]} | ||
(:require [midje.sweet :refer :all] | ||
[milia.utils.images :refer :all])) | ||
[milia.utils.images :refer [resize-image]])) | ||
|
||
(facts "about resize-image" | ||
(fact "should return with image-url and edge dimension" | ||
(resize-image "s3.aws.org" 80) => | ||
"https://images.ona.io/unsafe/80x80/smart/s3.aws.org") | ||
(facts | ||
"about resize-image" | ||
(fact "should return with image-url and edge dimension" | ||
(resize-image "s3.aws.org" 80) => | ||
"https://images.ona.io/unsafe/80x80/smart/s3.aws.org") | ||
|
||
(fact "should return with image-url, width and height dimension" | ||
(resize-image "s3.aws.org" 80 56) | ||
=> "https://images.ona.io/unsafe/80x56/smart/s3.aws.org") | ||
(fact "should return with image-url, width and height dimension" | ||
(resize-image "s3.aws.org" 80 56) | ||
=> "https://images.ona.io/unsafe/80x56/smart/s3.aws.org") | ||
|
||
(fact "should return with image-url, width and height dimension as well | ||
(fact "should return with image-url, width and height dimension as well | ||
as optional image-server-url" | ||
(resize-image "s3.aws.org" 80 56 "https://images.test.org") | ||
=> "https://images.test.org/unsafe/80x56/smart/s3.aws.org")) | ||
(resize-image "s3.aws.org" 80 56 "https://images.test.org") | ||
=> "https://images.test.org/unsafe/80x56/smart/s3.aws.org") | ||
(fact | ||
"Works with thumbor 7.5.0" | ||
(resize-image | ||
"https://images.test.org/image/some-hash/image-name.jpg" | ||
80 | ||
56 | ||
"https://images.test.org") | ||
=> "https://images.test.org/unsafe/80x56/smart/some-hash/image-name.jpg")) |