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:
taroj1205 2025-05-16 11:15:14 +12:00
parent 966da54a29
commit 133bbc20be
No known key found for this signature in database
GPG key ID: 0FCB6CFFE0981AB7
20 changed files with 2339 additions and 152 deletions

View 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')
})
})