movex
movex copied to clipboard
[libs/movex] Add specs for `createDispatch()` method
Where
libs/movex/src/lib/tools/dispatch.spec.ts
What
Create a new spec file to test the createDispatch() function
Why
The dispatcher is a very important piece of functionality that sits at the core of movex.
Definition of done
- it tests a
dispatch()
fn is returned correctly - it tests the returned
dispatch()
can makes changes on the given$checkedState
Observable - it tests a
unsubscribe()
fn is returned correctly - it tests that calling the
unsubscriber
fn stops listening for update changes from the$checkedState
Observable - any other tests that are relevant
This is a pretty important and complex issue. I can discuss it further!
Hey can you assign this to me?
Yep! Thank you
Hey, I was just little baffled with using states and checked states for testcases, Can you guide me how should I use Observable and CheckedState for the same?
Sure, I can try to give you a summary.
So, the Observable is simply an object that:
- holds a state
- provides an API to make changes to the state – via
update()
- and can notify listeners when the state changes, via
onUpdated(fn: (state: CheckedState<TState>) => void)
The $checkedState is the data + the checksum of the data. You can see here what the checksums are and why they are important https://www.movex.dev/docs/how/state_synchronization#1-use-the-checksums-to-its-advantage-optimal
Let me know if this clarifies it a bit, and let me know if you still have questions!
Hey @Devanshi-Crypto, are you still working on this? Do you need any help from me?
Let me know if you have any more questions and I'd be more than happy to assist. You can also join our discord https://discord.gg/N8k447EmBh where the community can help too!
Hey sorry, so I am kind of stuck here and trying to solve errors in checkedstate. Do you have any suggestions? Also yes I'm joining your discord, let's discuss there!
Will check this tomorrow! Can you describe the issue a bit – are those compilation errors?
yep, i am trying to solve but i got confused
Hey @Devanshi-Crypto sorry for taking so long to answer – I was a bit busy with life in the past days!
So I'm a bit confused what's going on here! Could open a PR with the changes you've made so far so I can take a look at the code?!
Thank you, and looking forward to help with this! 🙌
Closing for now