mirror of
https://github.com/littensy/charm.git
synced 2026-10-20 17:51:37 +00:00
feat(sync): add autoSerialize option (#42)
* feat(sync): add `autoSerialize` option * docs: fix `autoSerialize` note * docs: fix typo
This commit is contained in:
parent
8eddd182d3
commit
b8bb123379
8 changed files with 55 additions and 49 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -12,12 +12,9 @@ return function()
|
|||
array_sparse_invalid = { value = { [1] = 0, [3] = 0 }, expected = false },
|
||||
|
||||
map_decimal_key = { value = { [1.5] = 0 }, expected = false },
|
||||
map_infinity_key = { value = { [math.huge] = true }, expected = false },
|
||||
map_mixed_key = { value = { [1] = 0, a = 0 }, expected = false },
|
||||
|
||||
number = { value = 1, expected = true },
|
||||
number_infinity = { value = math.huge, expected = false },
|
||||
number_nan = { value = 0 / 0, expected = false },
|
||||
|
||||
nested_atom = { value = atom(0), expected = false },
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue