Starting Frontend Testing Again, Part 1
Starting Frontend Testing Again, Part 1
I was doing Cypress when I got laid off suddenly along with 50% of the staff from my last tech startup. Yep. Good memories - not. But so happy everything happened the way it did because it got me to where I am today. Right so anyway yeah.
Working on a test for my current team.
And so my lovely and wonderful colleague sent me the docs. Now everyone knows reading is a challenge. So as always I am doing the best I can.
There are a few links
She has sent me three - one one the jest object, one on expects, and one on react testing. I am so overwhelmed and don't know where to start - and have an hour less for this than I planned to. Okay cool have postponed meeting - now have a lot more time. Time to stay focused then.
The Jest Object
Okay. Bear in mind a might know a lot of this from Pytest but not realise. I don't know if it's similar or not. I don't know it if it's different. I know nothing. Thanks.
Whenever you write a file name `*.test.js` or `*.spec.js`, Jest makes a `jest` object available to you without any imports.
What the jest object allows you to do:
- Create fake versions of functions or modules
- "Spy on" or "Wrap" real functions to see how they're called
- Huh?
- Eh?
- You can let jest watch every call - how many times was the function called? What were the arguments? What did it return? This sounds like the pycharm debugger. Fun but not my thing (the Pycharm debugger that is).
- Set "control timers" - "fast-forward? `setTimeout/setInterval`". What does this mean?
- Ah these two pause and wait an actual amount of time before doing something else
- I don't know what the actual difference is please thanks
- Ah does setInterval periodically repeat things until you clearInterval? Thank you
![]() |
.png)
Comments
Post a Comment