peer-base / js-delta-crdts

Delta State-based CRDTs in Javascript
192 stars 16 forks source link

test CRDTs with (de)serialisation factored in #13

Closed pgte closed 5 years ago

pgte commented 5 years ago

Mentioned by @dirkmc, this problem was triggered by msgpack encode / decode properties.

There should be a way of performing the tests with differences introduced by serialisation / deserialization factored in.

dirkmc commented 5 years ago

I suggest

  1. Add a module to js-delta-crdts that exports

    • getReplica(type, id)
    • type: Type of CRDT (eg 'RGA')
    • id: eg 'my rga' Defaults to CRDT(type)(id)
    • implementReplica(fn)
    • fn: a function that implements getReplica()
  2. modify the tests to use getReplica() and await a synchronization function before checking replace.value()

  3. Add a script to peer-star-app that

    • calls implementReplica() with a function that returns a Shared
    • Programmatically executes the js-delta-crdts tests (this is easy with mocha)
dirkmc commented 5 years ago

Ah great this PR looks like it takes care of the issue in a simpler way, I think we can close this issue right?

pgte commented 5 years ago

I went with a different approach on this. Instead of entering the tests in peer-star-app, I made a custom serialization package (delta-crdts-msgpack-codec) and use it to test the transmission on deltas. (Also managed to catch a few bugs on a new feature with this).

This landed on v0.4.0.