Skip to content

Does mst support computed functions ? #1997

Closed Answered by coolsoftwaretyler
ansachs asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @ansachs - sorry it took so long for a response.

I'm not sure if this is precisely what you're looking for, but in a lot of the tests I write for work where we need MST to return certain values, I use either applySnapshot or applyPatch to directly manipulate the store.

It feels a little "wrong" to be reaching in and manipulating the store sometimes in the middle of a test, but if you were planning on mocking properties anyway, I think this approach is analogous (and in many ways, a little more robust, since it will trigger patch/snapshot listeners and such).

Is that useful? Did you figure this out in a different way to meet your needs? Would love to hear what worked or not for you.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@coolsoftwaretyler
Comment options

Answer selected by coolsoftwaretyler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants