1
0
mirror of https://github.com/kremalicious/portfolio.git synced 2024-12-22 09:13:19 +01:00
This commit is contained in:
Matthias Kretschmann 2024-02-04 11:51:49 +00:00
parent 9705015d69
commit 5a2f2478c9
Signed by: m
GPG Key ID: 606EEEF3C479A91F
3 changed files with 7 additions and 3 deletions

View File

@ -1,4 +1,4 @@
import { render } from '@testing-library/react' import { render, screen } from '@testing-library/react'
import projectsMock from '../../../tests/__fixtures__/projects.json' import projectsMock from '../../../tests/__fixtures__/projects.json'
import reposMock from '../../../tests/__fixtures__/repos.json' import reposMock from '../../../tests/__fixtures__/repos.json'
import Page from '../page' import Page from '../page'
@ -14,5 +14,8 @@ jest.mock('../../lib/github', () => ({
describe('app: /page', () => { describe('app: /page', () => {
it('renders correctly', async () => { it('renders correctly', async () => {
render(await Page()) render(await Page())
const location = await screen.findByText('Lisbon')
expect(location).toBeInTheDocument()
}) })
}) })

View File

@ -21,7 +21,7 @@ const customJestConfig: Config = {
collectCoverageFrom: [ collectCoverageFrom: [
'src/**/*.{ts,tsx}', 'src/**/*.{ts,tsx}',
'!src/**/*.{stories,test}.{ts,tsx}', '!src/**/*.{stories,test}.{ts,tsx}',
'!src/@types/**/*.{ts,tsx}' '!src/types/**/*.{ts,tsx}'
], ],
// note: this does not work with Next.js, hence workaround further down // note: this does not work with Next.js, hence workaround further down
// see: https://github.com/vercel/next.js/issues/35634#issuecomment-1115250297 // see: https://github.com/vercel/next.js/issues/35634#issuecomment-1115250297

View File

@ -13,7 +13,8 @@ jest.mock('../src/app/actions', () => ({
getLocation: jest.fn().mockImplementation(() => dataLocation), getLocation: jest.fn().mockImplementation(() => dataLocation),
getRandomGif: jest getRandomGif: jest
.fn() .fn()
.mockImplementation(() => giphy.data.images.original.mp4) .mockImplementation(() => giphy.data.images.original.mp4),
preloadLocation: jest.fn()
})) }))
const unmockedFetch = global.fetch const unmockedFetch = global.fetch