I did some searching, but was unable to find a simple answer to my use-case. I apologize in advance if there already exists a sufficiently similar question on SO.
I have an observable, myObservable
, that continuously streams a value from a store (i.e. it represents the state of the store). I want to test, with Jest, that my observable is able to correctly update when changes happen to the store.
// i.e. every time the value changes, an event is emitted by myObservable
myObservable.subscribe(x => console.log(x))
So what I really want to do is something like the following:
await myStore.set(0)
// insert here: check that `myObservable` stream is a 0
await myStore.set(5)
// insert here: check that `myObservable` stream is a 5
Basically I need a way to "tap" in to myObservable
at any point in time to see what value was last emitted. Sorry if this is a bit of a n00b question.
Aucun commentaire:
Enregistrer un commentaire