movex icon indicating copy to clipboard operation
movex copied to clipboard

[libs/movex] Add specs for `createDispatch()` method

Open GabrielCTroia opened this issue 1 year ago • 9 comments

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!

GabrielCTroia avatar Oct 07 '23 02:10 GabrielCTroia

Hey can you assign this to me?

Devanshi-Crypto avatar Oct 08 '23 16:10 Devanshi-Crypto

Yep! Thank you

GabrielCTroia avatar Oct 08 '23 18:10 GabrielCTroia

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?

Devanshi-Crypto avatar Oct 10 '23 02:10 Devanshi-Crypto

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!

GabrielCTroia avatar Oct 10 '23 02:10 GabrielCTroia

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!

GabrielCTroia avatar Oct 14 '23 20:10 GabrielCTroia

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! image

Devanshi-Crypto avatar Oct 15 '23 06:10 Devanshi-Crypto

Will check this tomorrow! Can you describe the issue a bit – are those compilation errors?

GabrielCTroia avatar Oct 15 '23 06:10 GabrielCTroia

yep, i am trying to solve but i got confused

Devanshi-Crypto avatar Oct 16 '23 01:10 Devanshi-Crypto

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! 🙌

GabrielCTroia avatar Oct 20 '23 18:10 GabrielCTroia

Closing for now

GabrielCTroia avatar Oct 12 '24 18:10 GabrielCTroia