feat(sync): add autoSerialize option (#42)

* feat(sync): add `autoSerialize` option

* docs: fix `autoSerialize` note

* docs: fix typo
This commit is contained in:
richard 2025-01-25 14:07:14 -08:00 • committed by GitHub
parent 8eddd182d3
commit b8bb123379
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 55 additions and 49 deletions

View file

@ -100,7 +100,7 @@ return function()
end)
it("optionally fixes sparse arrays", function()
for index in next, patch.diff({ 1, 1, 1, 1, 1 }, { 2, 1, 1, 2 }) do
for index in next, patch.diff({ 1, 1, 1, 1, 1 }, { 2, 1, 1, 2 }, true) do
expect(index).to.be.a("string")
end
@ -108,4 +108,14 @@ return function()
expect(index).to.be.a("number")
end
end)
it("optionally validates state", function()
expect(function()
patch.diff({}, { [0.1] = true }, true)
end).to.throw()
expect(function()
patch.diff({}, { [0.1] = true }, false)
end).to.never.throw()
end)
end