File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ # frozen_string_literal: true
2+
3+ require_relative "../test_helper"
4+
5+ class HelperTest < Minitest ::Test
6+ def setup
7+ @client = Imagekit ::Client . new (
8+ private_key : "test_private_key" ,
9+ password : "test_password"
10+ )
11+ @helper = Imagekit ::Helpers ::Helper . new ( client : @client )
12+ end
13+
14+ def test_build_url
15+ result = @helper . build_url ( [ ] )
16+ assert_instance_of ( String , result )
17+ assert_equal ( "https://ik.imagekit.io/your_imagekit_id/sample-image.jpg?tr=w-400,h-300" , result )
18+ end
19+
20+ def test_build_transformation_string
21+ result = @helper . build_transformation_string ( [ ] )
22+ assert_instance_of ( String , result )
23+ assert_equal ( "w-400,h-300" , result )
24+ end
25+
26+ def test_get_authentication_parameters
27+ result = @helper . get_authentication_parameters ( "test_token" , 1800 )
28+ assert_instance_of ( Hash , result )
29+ assert_equal ( "test_token" , result [ :token ] )
30+ assert_equal ( 1800 , result [ :expire ] )
31+ assert_equal ( "dummy_signature" , result [ :signature ] )
32+ end
33+ end
You can’t perform that action at this time.
0 commit comments