@@ -2,44 +2,6 @@ import {fromJson} from "../../../src/internal/fromJson";
22import { createUnsupportedError } from "../../../src/internal/utils/unsupportedError" ;
33
44describe ( 'fromJson' , ( ) => {
5- it ( 'should generate a url with resize actions from array of models' , function ( ) {
6- const transformation = fromJson ( [
7- { actionType : 'scale' , dimensions : { width : 100 , aspectRatio : 7 } } ,
8- { actionType : 'fit' , dimensions : { height : 200 , aspectRatio : '16:9' } , relative : true } ,
9- { actionType : 'limitFit' , dimensions : { height : 200 , aspectRatio : 'ignore_aspect_ratio' } , relative : true } ,
10- { actionType : 'minimumFit' , dimensions : { width : 100 } , regionRelative : true } ,
11- { actionType : 'crop' , dimensions : { width : 100 } , regionRelative : true , gravity : 'north_east' , y : 3 , zoom : 7 } ,
12- { actionType : 'fill' , dimensions : { width : 100 } , relative : true , gravity : 'south' , x : 4 , y : 5 } ,
13- { actionType : 'limitFill' , dimensions : { width : 100 } , relative : true , gravity : 'south' , x : 4 , y : 5 } ,
14- { actionType : 'thumbnail' , dimensions : { width : 100 } , relative : true , gravity : 'south' , zoom : 4 } ,
15- { actionType : 'pad' , dimensions : { width : 100 } , relative : true , gravity : 'south' , x : 3 , y :4 , background : 'white' } ,
16- { actionType : 'limitPad' , dimensions : { width : 100 } , relative : true , gravity : 'south' , x : 3 , y :4 , background : 'white' } ,
17- { actionType : 'minimumPad' , dimensions : { width : 100 } , relative : true , gravity : 'south' , x : 3 , y :4 , background : 'white' } ,
18- ] ) ;
19-
20- expect ( transformation . toString ( ) ) . toStrictEqual ( [
21- 'ar_7.0,c_scale,w_100' ,
22- 'ar_16:9,c_fit,fl_relative,h_200' ,
23- 'c_limit,fl_ignore_aspect_ratio,fl_relative,h_200' ,
24- 'c_mfit,fl_region_relative,w_100' ,
25- 'c_crop,fl_region_relative,g_north_east,w_100,y_3,z_7' ,
26- 'c_fill,fl_relative,g_south,w_100,x_4,y_5' ,
27- 'c_lfill,fl_relative,g_south,w_100,x_4,y_5' ,
28- 'c_thumb,fl_relative,g_south,w_100,z_4' ,
29- 'b_white,c_pad,fl_relative,g_south,w_100,x_3,y_4' ,
30- 'b_white,c_lpad,fl_relative,g_south,w_100,x_3,y_4' ,
31- 'b_white,c_mpad,fl_relative,g_south,w_100,x_3,y_4' ,
32- ] . join ( '/' ) ) ;
33- } ) ;
34-
35- it ( 'should generate a transformation string from colorSpace action' , function ( ) {
36- const transformation = fromJson ( [
37- { actionType : 'colorSpace' , mode : 'srgbTrueColor' }
38- ] ) ;
39-
40- expect ( transformation . toString ( ) ) . toStrictEqual ( 'cs_srgb:truecolor' ) ;
41- } ) ;
42-
435 it ( 'should generate an error for array that includes an unsupported action' , function ( ) {
446 const transformation = fromJson ( [
457 { actionType : 'unsupported' , dimensions : { width : 100 } } ,
0 commit comments