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 reposMock from '../../../tests/__fixtures__/repos.json'
import Page from '../page'
@ -14,5 +14,8 @@ jest.mock('../../lib/github', () => ({
describe('app: /page', () => {
it('renders correctly', async () => {
render(await Page())
const location = await screen.findByText('Lisbon')
expect(location).toBeInTheDocument()
})
})

View File

@ -21,7 +21,7 @@ const customJestConfig: Config = {
collectCoverageFrom: [
'src/**/*.{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
// 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),
getRandomGif: jest
.fn()
.mockImplementation(() => giphy.data.images.original.mp4)
.mockImplementation(() => giphy.data.images.original.mp4),
preloadLocation: jest.fn()
}))
const unmockedFetch = global.fetch