Skip to content

Commit 374eaa3

Browse files
committed
test: add e2e test for share card
1 parent 2b9e6c2 commit 374eaa3

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

test/e2e/og-image.spec.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,20 @@ for (const path of paths) {
2727
})
2828
})
2929
}
30+
31+
test.describe('share card', () => {
32+
for (const theme of ['dark', 'light'] as const) {
33+
test(`share card for nuxt (${theme})`, async ({ page, baseURL }) => {
34+
const base = baseURL?.endsWith('/') ? baseURL.slice(0, -1) : baseURL
35+
const response = await page.request.get(`${base}/api/card/nuxt.png?theme=${theme}`)
36+
37+
expect(response.status()).toBe(200)
38+
expect(response.headers()['content-type']).toContain('image/png')
39+
40+
const imageBuffer = await response.body()
41+
expect(imageBuffer).toMatchSnapshot({
42+
name: `share-card-nuxt-${theme}.png`,
43+
})
44+
})
45+
}
46+
})
45.5 KB
Loading
47.6 KB
Loading

0 commit comments

Comments
 (0)