When i run test, it fails with the TypeError: this.contextRender is not a function when using shallow error.
This is my test:
import { h } from 'preact'
import { shallow } from 'preact-render-spy'
import { App } from '../../src/app'
describe('App', () => {
test('renders', () => {
const context = shallow(<App />)
expect(context.find('div').contains(<a>link</a>)).toBeTruthy()
})
})
This is error i get:
FAIL test/src/app.test.js
App
✕ renders (4ms)
● App › renders
TypeError: this.contextRender is not a function
5 | describe('App', () => {
6 | test('renders', () => {
> 7 | const context = shallow(<App />)
| ^
8 | expect(context.find('div').contains(<a>link</a>)).toBeTruthy()
9 | })
10 | })
at RenderContext.render (node_modules/preact-render-spy/src/preact-render-spy.js:462:10)
at deep (node_modules/preact-render-spy/src/preact-render-spy.js:472:76)
at shallow (node_modules/preact-render-spy/src/preact-render-spy.js:473:25)
at Object.<anonymous> (test/src/app.test.js:7:21)
Test Suites: 1 failed, 1 total
Tests: 1 failed, 1 total
Snapshots: 0 total
Time: 2.196s
Ran all test suites.
When i run test, it fails with the
TypeError: this.contextRender is not a function when using shallow
error.This is my test:
This is error i get: