1
0
mirror of https://github.com/kremalicious/portfolio.git synced 2024-12-23 01:29:41 +01:00
portfolio/tests/setup-test-env.js

22 lines
620 B
JavaScript
Raw Normal View History

2019-07-08 18:29:29 +02:00
import '@testing-library/jest-dom/extend-expect'
2019-04-16 21:21:01 +02:00
import 'jest-canvas-mock'
2019-11-13 14:08:57 +01:00
import { StaticQuery, useStaticQuery } from 'gatsby'
2021-03-13 01:03:23 +01:00
import { getSrc } from 'gatsby-plugin-image'
2019-11-13 14:08:57 +01:00
import meta from './__fixtures__/meta.json'
import resume from './__fixtures__/resume.json'
2019-11-25 13:46:44 +01:00
import projects from './__fixtures__/projects.json'
2019-11-13 14:08:57 +01:00
beforeAll(() => {
2021-03-13 01:03:23 +01:00
const photoSrc = getSrc(resume.contentJson.basics.picture)
2019-11-13 14:08:57 +01:00
const dataMock = {
...meta,
...resume,
photoSrc,
2019-11-25 13:46:44 +01:00
...projects
2019-11-13 14:08:57 +01:00
}
StaticQuery.mockImplementation(({ render }) => render({ ...dataMock }))
2019-11-25 13:46:44 +01:00
useStaticQuery.mockImplementation(() => ({ ...dataMock }))
2019-11-13 14:08:57 +01:00
})