feat: add optional convertArrays

This commit is contained in:
Richard 2024-10-30 15:27:55 -07:00
parent e4019c049c
commit 13e06dd44c
9 changed files with 72 additions and 60 deletions

View file

@ -52,12 +52,13 @@ return function()
expect(applied["4"]).to.never.be.ok()
end)
it("preserves array density after serdes", function()
itFOCUS("preserves array density after serdes", function()
-- This particular change results in a patch that cannot be serialized
-- without losing information. Charm resolves this issue internally.
local prevState = { "a", "b", "c", "d", "e" }
local nextState = { "A", "b", "c", "D" }
-- FIXME: The [0] index used to fix serialization issues is not preserved
local patches = serdes(patch.diff(prevState, nextState))
local applied = patch.apply(prevState, patches)

View file

@ -49,7 +49,7 @@ return function()
server:_sendPatch(target)
expect(payload.data.a.b).to.never.be.ok()
expect(payload.data.a.c).to.equal(patch.NONE)
expect(payload.data.a.c).to.equal(patch.None)
expect(payload.data.a.d).to.equal(1)
disconnect()