From 2c6651386b45c7037a5b01c51b612fea0cbbbbca Mon Sep 17 00:00:00 2001 From: Mathea Liv Date: Thu, 17 Sep 2026 18:44:44 +0200 Subject: [PATCH] snapshot test for songcard --- src/components/SongCard.test.tsx | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/components/SongCard.test.tsx diff --git a/src/components/SongCard.test.tsx b/src/components/SongCard.test.tsx new file mode 100644 index 0000000..b04e6f9 --- /dev/null +++ b/src/components/SongCard.test.tsx @@ -0,0 +1,28 @@ +import React from 'react' +import { render } from '@testing-library/react' +import { vi, describe, it, expect } from 'vitest' +import { SongCard } from './SongCard' +import type { Song } from '../data/songs' + +vi.mock('../hooks/useLyrics', () => ({ + useLyrics: (artist: string, title: string) => ({ + data: { lyrics: `Lyrics for ${artist} - ${title}` }, + isLoading: false, + error: null, + }), +})) + +const song: Song = { + id: 'test-song', + artist: 'Test Artist', + title: 'Test Title', + album: 'Test Album', +} + +describe('SongCard', () => { + it('matches snapshot', () => { + const { asFragment } = render() + + expect(asFragment()).toMatchSnapshot() + }) +})