mirror of
https://github.com/kremalicious/portfolio.git
synced 2024-12-22 17:23:22 +01:00
Matthias Kretschmann
447cada700
* next.js + typescript * more testing * script updates * fixes * favicon generation * testing * readme updates * tweaks * tweaks * move tests * image tweaks * ci tweaks * commit next-env.d.ts for ci * migrations * fixes * fixes * ci tweaks * new animations * project preview tweaks * add codeclimate config * dark mode refactor, test tweaks * readme updates * animation tweaks * animate in loaded images * test update * update humans.txt
35 lines
789 B
TypeScript
35 lines
789 B
TypeScript
import '@testing-library/jest-dom/extend-expect'
|
|
import 'jest-canvas-mock'
|
|
import { jest } from '@jest/globals'
|
|
import giphy from './__fixtures__/giphy.json'
|
|
import './__mocks__/matchMedia'
|
|
|
|
jest.mock('next/router', () => ({
|
|
useRouter: jest.fn().mockImplementation(() => ({
|
|
route: '/',
|
|
asPath: '/'
|
|
}))
|
|
}))
|
|
|
|
jest.mock('next/head', () => {
|
|
return {
|
|
__esModule: true,
|
|
default: ({ children }: { children: Array<React.ReactElement> }) => {
|
|
return <>{children}</>
|
|
}
|
|
}
|
|
})
|
|
|
|
jest.mock('@giphy/js-fetch-api', () => ({
|
|
GiphyFetch: jest.fn().mockImplementation(() => ({
|
|
random: jest.fn().mockImplementation(() => Promise.resolve(giphy))
|
|
}))
|
|
}))
|
|
|
|
const unmockedFetch = global.fetch
|
|
|
|
afterEach(() => {
|
|
global.fetch = unmockedFetch
|
|
jest.restoreAllMocks()
|
|
})
|