forked from oceanprotocol/market
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetupTests.ts
26 lines (22 loc) · 945 Bytes
/
setupTests.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import '@testing-library/jest-dom/extend-expect'
import * as Gatsby from 'gatsby'
import siteMetadata from './__fixtures__/siteMetadata.json'
import gdprMetadata from './__fixtures__/gdprMetadata.json'
import UserPreferences from './__fixtures__/useUserPreferences'
import * as UseUserPreferences from '../../src/providers/UserPreferences'
import('./__mocks__/matchMedia')
const useStaticQuery = jest.spyOn(Gatsby, 'useStaticQuery')
const useUserPreferences = jest.spyOn(UseUserPreferences, 'useUserPreferences')
// const useWeb3 = jest.spyOn(oceanReact, 'useWeb3')
// const useOcean = jest.spyOn(oceanReact, 'useOcean')
export const globalMock = {
...siteMetadata,
...gdprMetadata
}
beforeAll(() => {
jest.mock('web3')
jest.mock('@oceanprotocol/lib')
// useOcean.mockImplementation(() => mockReact.useOcean())
useStaticQuery.mockImplementation(() => globalMock)
useUserPreferences.mockImplementation(() => UserPreferences)
})