I've found that a mock I'm using, which will return a string, is seemingly returning jest.fn()
rather than the "implementation" of the mock being jest.fn().mockImplementation(...)
.
I'm calling it as so:
const mockDefaultQuery = 'query { mock }'
jest.mock('../functions', () => (
{
getArticle: jest.fn().mockName('getArticle').mockImplementation(() => {
return {}
}),
defaultQuery: jest.fn().mockImplementation(() => {
return mockDefaultQuery
})
})
)
but the call to defaultQuery from the imported 'functions' library returns [Function mockConstructor] in the test scope rather than "query { mock }" as defined by the const it should be returning.
I've also tried using jest.fn().mockReturnValue(mockDefaultQuery)
but to no avail.