4 ms·
I’d recommend tests, also you may be able to return the promise directly instead of wrapping it in essentially a promise constructor. It could also be more effi
by joshribakoff 6y ago
I’d recommend tests, also you may be able to return the promise directly instead of wrapping it in essentially a promise constructor. It could also be more efficient with an (ordered) set or linked list instead of an array. Otherwise looks fine but I’ll keep using rxjs ;p you should check it out. If you search my name on YouTube I made a whole playlist. The official docs are good too.
- arrow7000 6y agoThanks for the feedback! I've spent a lot of time trying to add tests but ran into a ton of problems trying to get Jest's useFakeTimers and promises to play well together. I will take another crack at to see if I can work around the problems this time. Not sure I understand what you mean by returning the promise directly? Could you explain a bit more why using sets or linked lists would help with efficiency here? Thanks I'll check out your playlist!
- joshribakoff 6y agoRe: jest, make sure to flush the event queue! Eg await Promise.resolve() which causes the test to pause while all promises queued by the code under test up until that point flush