Assume func is a synchronized function. tap(_ => func()) will call the function lazily. However, mapTo(func()) will call the function eagerly.
forkJoinwill not emit anything if the input is an empty array.forkJoinonly emit one value than complete.- Use
zipwhen you want to emit more than one values.
toArrayonly works on source observable completed.- Use
scan((acc, arr) => [...acc, ...arr], [] as T)to emit values without the source completing. However, this might cause duplicated elements in emitted values.
You never know if an observable emits more than one value! Thus, I prefer use Promise as a "eager" replacement for Single.
The finalize operator will not get invoked in the order you expected. It will be invoked after unsubscription and thus makes the test of the function inside finalize impossible. See this issue for more details.
Marble test requires the observable to be synchronous. Thus, any observable from Promise, such as defer or from, will fail the test.