mirror of
https://github.com/zen-browser/www.git
synced 2025-07-07 17:05:32 +02:00
feat(tests): integrate Playwright and Vitest for testing, add CI pipeline, and update dependencies
- Added Playwright configuration for end-to-end testing. - Integrated Vitest for unit testing with setup files. - Updated package.json scripts for testing commands. - Created CI pipeline for automated testing and builds. - Added various test cases for components and pages. - Updated .gitignore to exclude Playwright and coverage. - Enhanced ModsList component with additional class for styling.
This commit is contained in:
parent
966da54a29
commit
133bbc20be
20 changed files with 2339 additions and 152 deletions
47
src/tests/components/ButtonCard.test.ts
Normal file
47
src/tests/components/ButtonCard.test.ts
Normal file
|
@ -0,0 +1,47 @@
|
|||
import { experimental_AstroContainer as AstroContainer } from 'astro/container'
|
||||
import { beforeEach, describe, expect, it } from 'vitest'
|
||||
import ButtonCard from '~/components/download/ButtonCard.astro'
|
||||
|
||||
describe('<ButtonCard />', () => {
|
||||
let container: Awaited<ReturnType<typeof AstroContainer.create>>
|
||||
beforeEach(async () => {
|
||||
container = await AstroContainer.create()
|
||||
})
|
||||
|
||||
it('renders with required props', async () => {
|
||||
const result = await container.renderToString(ButtonCard, {
|
||||
props: {
|
||||
label: 'Download',
|
||||
href: '/download',
|
||||
},
|
||||
})
|
||||
expect(result).toContain('Download')
|
||||
expect(result).toContain('href="/download"')
|
||||
expect(result).not.toContain('Show SHA-256')
|
||||
})
|
||||
|
||||
it('renders with checksum', async () => {
|
||||
const result = await container.renderToString(ButtonCard, {
|
||||
props: {
|
||||
label: 'Download',
|
||||
href: '/download',
|
||||
checksum: 'sha256sum',
|
||||
},
|
||||
})
|
||||
expect(result).toContain('Show SHA-256')
|
||||
expect(result).toContain('sha256sum')
|
||||
expect(result).toContain('Copy')
|
||||
})
|
||||
|
||||
it('renders with variant', async () => {
|
||||
const result = await container.renderToString(ButtonCard, {
|
||||
props: {
|
||||
label: 'Download',
|
||||
href: '/download',
|
||||
variant: 'flathub',
|
||||
},
|
||||
})
|
||||
expect(result).toContain('Download')
|
||||
expect(result).toContain('Beta')
|
||||
})
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue