Closed RapidOwl closed 2 years ago
Hello,
The errors are occurring in the
RenderQuiz
function, which I'm not even executing as part of this test.
Actually, you are. You've mixed up default & named exports in your test I'm afraid.
import Result from './quiz'; --> RenderQuiz()
import { Result } from './quiz'; --> Result()
Happens to all of us.
Oh good grief! I’m such a newb!
Thank you so much for taking the time to help.
No worries.
That should fix your issues and get you a working test.
That worked. Now I just need to sort out import aliases for Vitest so I can keep using CDN imports in the browser.
Thanks again!
I'm really sorry to create another issue about this (previous issue). I thought I'd got it solved after the switch to Vitest, but I just can't figure it out.
I'm trying to test a single functional component, but for some reason other functions in the component's file are being executed (and erroring) and I don't understand why.
Here's the test file: https://github.com/RapidOwl/qaas/blob/testing/src/quiz.test.js
Errors:
Objects are not valid as a child. Encountered an object with the keys {}.
(something about promises?)Cannot read properties of null (reading '__k')
(???)The errors are occurring in the
RenderQuiz
function, which I'm not even executing as part of this test.Please can someone link me to an example of Preact + HTM testing that I can crib from. I don't want to switch to JSX + Enzyme as I really like the minimal development experience.