File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed
Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change 1+ const chai = require ( "chai" ) ;
2+ const expect = chai . expect ;
3+ const initializationParams = require ( "./data" ) . initializationParams
4+ const ImageKit = require ( ".." ) ; // This will automatically pick main module (cjs bundle) as per package.json
5+
6+
7+ describe ( "Authentication params check" , function ( ) {
8+ var imagekit = new ImageKit ( {
9+ publicKey : "public_key_test" ,
10+ privateKey : "private_key_test" ,
11+ urlEndpoint : "https://test-domain.com/test-endpoint"
12+ } ) ;
13+
14+ it ( 'Singature should be correct' , function ( ) {
15+ var authenticationParameters = imagekit . getAuthenticationParameters ( "your_token" , 1582269249 ) ;
16+ expect ( authenticationParameters ) . to . deep . equal ( {
17+ token : 'your_token' ,
18+ expire : 1582269249 ,
19+ signature : 'e71bcd6031016b060d349d212e23e85c791decdd'
20+ } )
21+ } ) ;
22+ } ) ;
Original file line number Diff line number Diff line change @@ -33,6 +33,15 @@ describe("URL generation", function () {
3333 expect ( url ) . equal ( `https://ik.imagekit.io/test_url_endpoint/test_path_alt.jpg` ) ;
3434 } ) ;
3535
36+ it ( 'Signed URL' , function ( ) {
37+ const url = imagekit . url ( {
38+ path : "/test_path_alt.jpg" ,
39+ signed : true
40+ } ) ;
41+
42+ expect ( url ) . equal ( `https://ik.imagekit.io/test_url_endpoint/test_path_alt.jpg?ik-s=e26ca157df99b30b2443d7cb6886fc396fb4c87b` ) ;
43+ } ) ;
44+
3645 it ( 'should generate the correct url with path param' , function ( ) {
3746 const url = imagekit . url ( {
3847 path : "/test_path.jpg" ,
You can’t perform that action at this time.
0 commit comments