@@ -62,29 +62,30 @@ describe("Utilities", () => {
6262 } ) ;
6363
6464 describe ( "Image utilities" , ( ) => {
65+ let image ;
66+ beforeAll ( async ( ) => {
67+ image = await RawImage . fromURL ( "https://picsum.photos/300/200" ) ;
68+ } ) ;
69+
6570 it ( "Read image from URL" , async ( ) => {
66- const image = await RawImage . fromURL ( "https://picsum.photos/300/200" ) ;
6771 expect ( image . width ) . toBe ( 300 ) ;
6872 expect ( image . height ) . toBe ( 200 ) ;
6973 expect ( image . channels ) . toBe ( 3 ) ;
7074 } ) ;
7175
7276 it ( "Can resize image" , async ( ) => {
73- const image = await RawImage . fromURL ( "https://picsum.photos/300/200" ) ;
7477 const resized = await image . resize ( 150 , 100 ) ;
7578 expect ( resized . width ) . toBe ( 150 ) ;
7679 expect ( resized . height ) . toBe ( 100 ) ;
7780 } ) ;
7881
7982 it ( "Can resize with aspect ratio" , async ( ) => {
80- const image = await RawImage . fromURL ( "https://picsum.photos/300/200" ) ;
8183 const resized = await image . resize ( 150 , null ) ;
8284 expect ( resized . width ) . toBe ( 150 ) ;
8385 expect ( resized . height ) . toBe ( 100 ) ;
8486 } ) ;
8587
8688 it ( "Returns original image if width and height are null" , async ( ) => {
87- const image = await RawImage . fromURL ( "https://picsum.photos/300/200" ) ;
8889 const resized = await image . resize ( null , null ) ;
8990 expect ( resized . width ) . toBe ( 300 ) ;
9091 expect ( resized . height ) . toBe ( 200 ) ;
0 commit comments