All quizzesHard
Marble Testing
Preview — 3 of 10 questions
What is the Observable contract (Rx Contract) that every Observable must honor?
AAn Observable may emit any number of values in any order, including after completion or error
BAn Observable must always emit at least one value before completing
CAn Observable must call next* zero or more times, followed by exactly one error OR one complete — never both, and no emissions after either terminal event
DAn Observable can only emit synchronously — async emissions require Subject
How does TestScheduler achieve time-travel in virtual time tests?
AIt patches Date.now() and setTimeout globally during test execution
BIt runs the test in a Web Worker that runs at 1000x speed
CIt maintains a virtual clock and a priority queue of scheduled actions; flush() advances the clock synchronously, processing all scheduled work without real waiting
DIt uses JavaScript's performance.now() with a custom offset
When should you use effect() instead of toSignal(obs$.pipe(tap(...)))?
AUse effect() for side effects that should react to signal changes (logging, analytics, DOM updates); use toSignal() for binding Observable values to the template
BAlways use effect() — toSignal() doesn't support side effects
Ceffect() runs synchronously; toSignal() runs asynchronously — choose based on timing needs
DThere is no difference — effect() is built on toSignal() internally
Sign up free to play
Answer all 10 questions (7 more), see explanations for every answer, and track your score.