summaryrefslogtreecommitdiff
path: root/packages/integrations/vercel/test/image.test.js
diff options
context:
space:
mode:
authorGravatar Erika <3019731+Princesseuh@users.noreply.github.com> 2023-09-13 18:40:02 +0200
committerGravatar GitHub <noreply@github.com> 2023-09-13 18:40:02 +0200
commit9596db844b51cf0a7b832a04bec66f08ab41a396 (patch)
treed09750594adc145c95fc0ea449a3e8b3e5846028 /packages/integrations/vercel/test/image.test.js
parentd4c4eabc4293786c577df9da79915ae667c02853 (diff)
downloadastro-9596db844b51cf0a7b832a04bec66f08ab41a396.tar.gz
astro-9596db844b51cf0a7b832a04bec66f08ab41a396.tar.zst
astro-9596db844b51cf0a7b832a04bec66f08ab41a396.zip
feat(vercel): Use Sharp in dev instead of Squoosh by default (#8445)
* feat(vercel): Use Sharp in dev instead of Squoosh by default * fix(build): * nit: adjust with feedback * fix: imports * Update packages/integrations/vercel/README.md Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> * docs: small change in other part of the README --------- Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
Diffstat (limited to 'packages/integrations/vercel/test/image.test.js')
-rw-r--r--packages/integrations/vercel/test/image.test.js15
1 files changed, 13 insertions, 2 deletions
diff --git a/packages/integrations/vercel/test/image.test.js b/packages/integrations/vercel/test/image.test.js
index c5153cc6e..b8bc3af95 100644
--- a/packages/integrations/vercel/test/image.test.js
+++ b/packages/integrations/vercel/test/image.test.js
@@ -20,7 +20,7 @@ describe('Image', () => {
it('has link to vercel in build with proper attributes', async () => {
const html = await fixture.readFile('../.vercel/output/static/index.html');
const $ = cheerio.load(html);
- const img = $('img');
+ const img = $('#basic-image img');
expect(img.attr('src').startsWith('/_vercel/image?url=_astr')).to.be.true;
expect(img.attr('loading')).to.equal('lazy');
@@ -56,11 +56,22 @@ describe('Image', () => {
it('has link to local image in dev with proper attributes', async () => {
const html = await fixture.fetch('/').then((res) => res.text());
const $ = cheerio.load(html);
- const img = $('img');
+ const img = $('#basic-image img');
expect(img.attr('src').startsWith('/_image?href=')).to.be.true;
expect(img.attr('loading')).to.equal('lazy');
expect(img.attr('width')).to.equal('225');
});
+
+ it('supports SVGs', async () => {
+ const html = await fixture.fetch('/').then((res) => res.text());
+ const $ = cheerio.load(html);
+ const img = $('#svg img');
+ const src = img.attr('src');
+
+ const res = await fixture.fetch(src);
+ expect(res.status).to.equal(200);
+ expect(res.headers.get('content-type')).to.equal('image/svg+xml');
+ });
});
});