mirror of
https://github.com/kremalicious/portfolio.git
synced 2024-12-22 09:13:19 +01:00
fix test
This commit is contained in:
parent
9705015d69
commit
5a2f2478c9
@ -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()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user