I test the height of the window in Jest with jest-dom and jsdom.
With this code :
import '@testing-library/jest-dom'
describe('test window height'), () => {
test('test the height'), () => {
expect(window.innerHeight).toBe(150) // 150 is an arbitrary value for testing the test !
})
})
The result is an error that say :
Expected: 150
Received: 768
With innerWidth, the received value is 1024
That is great, it means that the size of window is testable with Jest and jest-dom.
But where does 768 and 1024 come from ? Is it the default values and will always be ? Is it configurable and how?