@@ -20,27 +20,27 @@ import { server } from './fixtures/mocks/node.js';
2020describe ( 'parseImageParams' , ( ) => {
2121 it ( 'should set values from URL if no options are provided' , ( ) => {
2222 const url = 'https://example.com/someimage.webp' ;
23- expect ( parseImageParams ( url ) ) . toMatchObject ( {
23+ expect ( parseImageParams ( url ) ) . toStrictEqual ( {
2424 url,
2525 name : 'someimage' ,
2626 extension : 'webp' ,
2727 directory : process . cwd ( ) ,
2828 originalName : 'someimage' ,
2929 originalExtension : 'webp' ,
30- path : path . resolve ( process . cwd ( ) , 'someimage.webp' ) ,
30+ path : path . resolve ( 'someimage.webp' ) ,
3131 } ) ;
3232 } ) ;
3333
3434 it ( 'should use default values if URL has no file ending' , ( ) => {
3535 const url = 'https://example.com/someimage' ;
36- expect ( parseImageParams ( url ) ) . toMatchObject ( {
36+ expect ( parseImageParams ( url ) ) . toStrictEqual ( {
3737 url,
3838 name : DEFAULT_NAME ,
3939 extension : DEFAULT_EXTENSION ,
4040 directory : process . cwd ( ) ,
4141 originalName : undefined ,
4242 originalExtension : undefined ,
43- path : path . resolve ( process . cwd ( ) , `${ DEFAULT_NAME } .${ DEFAULT_EXTENSION } ` ) ,
43+ path : path . resolve ( `${ DEFAULT_NAME } .${ DEFAULT_EXTENSION } ` ) ,
4444 } ) ;
4545 } ) ;
4646
@@ -58,7 +58,7 @@ describe('parseImageParams', () => {
5858 const url = 'https://example.com/image.jpg' ;
5959 const result = parseImageParams ( url , { directory : '' } ) ;
6060 expect ( result . directory ) . toBe ( process . cwd ( ) ) ;
61- expect ( result . path ) . toBe ( path . resolve ( process . cwd ( ) , 'image.jpg' ) ) ;
61+ expect ( result . path ) . toBe ( path . resolve ( 'image.jpg' ) ) ;
6262 } ) ;
6363
6464 it . each ( [
@@ -119,13 +119,11 @@ describe('parseImageParams', () => {
119119 'new.name' ,
120120 ' newname' ,
121121 ] ) ( 'should set a valid name: `%s`' , ( name ) => {
122- const url = 'https://example.com/someimage.jpg ' ;
122+ const url = 'https://example.com/someimage.webp ' ;
123123 const result = parseImageParams ( url , { name } ) ;
124124 expect ( result . originalName ) . toBe ( 'someimage' ) ;
125125 expect ( result . name ) . toBe ( name ) ;
126- expect ( result . path ) . toBe (
127- path . resolve ( process . cwd ( ) , `${ name } .${ DEFAULT_EXTENSION } ` ) ,
128- ) ;
126+ expect ( result . path ) . toBe ( path . resolve ( `${ name } .webp` ) ) ;
129127 } ) ;
130128
131129 it ( 'should throw error if name contains extension' , ( ) => {
@@ -182,9 +180,7 @@ describe('parseImageParams', () => {
182180 const result = parseImageParams ( url , { extension } ) ;
183181 expect ( result . originalExtension ) . toBe ( 'jpg' ) ;
184182 expect ( result . extension ) . toBe ( extension ) ;
185- expect ( result . path ) . toBe (
186- path . resolve ( process . cwd ( ) , `image.${ extension } ` ) ,
187- ) ;
183+ expect ( result . path ) . toBe ( path . resolve ( `image.${ extension } ` ) ) ;
188184 } ,
189185 ) ;
190186
@@ -227,7 +223,7 @@ describe('`download`', () => {
227223 const expectedImage = parseImageParams ( `${ BASE_URL } /image.jpg` ) ;
228224 const image = await download ( expectedImage ) ;
229225 try {
230- expect ( image ) . toMatchObject ( expectedImage ) ;
226+ expect ( image ) . toStrictEqual ( expectedImage ) ;
231227 await expect ( fs . promises . access ( image . path ) ) . resolves . not . toThrow ( ) ;
232228 } finally {
233229 await fs . promises . rm ( image . path , { force : true } ) ;
@@ -240,7 +236,7 @@ describe('`download`', () => {
240236 await expect ( download ( image ) ) . rejects . toThrow ( DirectoryError ) ;
241237 } ) ;
242238
243- it . each ( [ 'tmp' , 'tmp/images ' ] ) (
239+ it . each ( [ 'tmp' , 'test/tmp ' ] ) (
244240 'should create the directory if it does not exist: `%s`' ,
245241 async ( directory ) => {
246242 // Prepare: ensure the directory does not exist
0 commit comments