@@ -45,7 +45,7 @@ Deno.test("astro", async (t) => {
45
45
} ) ;
46
46
assertEquals (
47
47
result ?. toString ( ) ,
48
- "/_image?href=https%3A%2F%2Fimages.ctfassets.net%2Faaaa%2Fxxxx%2Fyyyy%2Fhow-to-wow-a-customer.jpg&w=200&h=100" ,
48
+ "/_image?href=https%3A%2F%2Fimages.ctfassets.net%2Faaaa%2Fxxxx%2Fyyyy%2Fhow-to-wow-a-customer.jpg&w=200&h=100&fit=cover " ,
49
49
) ;
50
50
} ) ;
51
51
@@ -58,24 +58,24 @@ Deno.test("astro", async (t) => {
58
58
} ) ;
59
59
assertEquals (
60
60
result ?. toString ( ) ,
61
- "/_image/?href=https%3A%2F%2Fimages.ctfassets.net%2Faaaa%2Fxxxx%2Fyyyy%2Fhow-to-wow-a-customer.jpg&w=200&h=100" ,
61
+ "/_image/?href=https%3A%2F%2Fimages.ctfassets.net%2Faaaa%2Fxxxx%2Fyyyy%2Fhow-to-wow-a-customer.jpg&w=200&h=100&fit=cover " ,
62
62
) ;
63
63
} ) ;
64
64
65
65
await t . step ( "should not set height if not provided" , ( ) => {
66
66
const result = transform ( { url : img , width : 200 } ) ;
67
67
assertEquals (
68
68
result ?. toString ( ) ,
69
- "/_image?href=https%3A%2F%2Fimages.ctfassets.net%2Faaaa%2Fxxxx%2Fyyyy%2Fhow-to-wow-a-customer.jpg&w=200" ,
69
+ "/_image?href=https%3A%2F%2Fimages.ctfassets.net%2Faaaa%2Fxxxx%2Fyyyy%2Fhow-to-wow-a-customer.jpg&w=200&fit=cover " ,
70
70
) ;
71
71
} ) ;
72
72
await t . step ( "should delete height if not set" , ( ) => {
73
73
const url = new URL ( img ) ;
74
- url . searchParams . set ( "h" , "100" ) ;
74
+ url . searchParams . set ( "h" , "100&fit=cover " ) ;
75
75
const result = transform ( { url, width : 200 } ) ;
76
76
assertEquals (
77
77
result ?. toString ( ) ,
78
- "/_image?href=https%3A%2F%2Fimages.ctfassets.net%2Faaaa%2Fxxxx%2Fyyyy%2Fhow-to-wow-a-customer.jpg&w=200" ,
78
+ "/_image?href=https%3A%2F%2Fimages.ctfassets.net%2Faaaa%2Fxxxx%2Fyyyy%2Fhow-to-wow-a-customer.jpg&w=200&fit=cover " ,
79
79
) ;
80
80
} ) ;
81
81
@@ -87,7 +87,7 @@ Deno.test("astro", async (t) => {
87
87
} ) ;
88
88
assertEquals (
89
89
result ?. toString ( ) ,
90
- "/_image?href=https%3A%2F%2Fimages.ctfassets.net%2Faaaa%2Fxxxx%2Fyyyy%2Fhow-to-wow-a-customer.jpg&w=201&h=100" ,
90
+ "/_image?href=https%3A%2F%2Fimages.ctfassets.net%2Faaaa%2Fxxxx%2Fyyyy%2Fhow-to-wow-a-customer.jpg&w=201&h=100&fit=cover " ,
91
91
) ;
92
92
} ) ;
93
93
@@ -100,7 +100,7 @@ Deno.test("astro", async (t) => {
100
100
} ) ;
101
101
assertEquals (
102
102
result ?. toString ( ) ,
103
- "/_image?href=%2Fstatic%2Fmoose.png&w=100&h=200&f=webp" ,
103
+ "/_image?href=%2Fstatic%2Fmoose.png&w=100&h=200&f=webp&fit=cover " ,
104
104
) ;
105
105
} ) ;
106
106
} ) ;
0 commit comments