mirror of
https://github.com/littensy/charm.git
synced 2026-10-21 11:44:08 +00:00
feat: prepare for alpha release
This commit is contained in:
parent
5a05f01223
commit
f5709c3112
10 changed files with 251 additions and 54 deletions
|
|
@ -8,13 +8,13 @@ local test = suite.test
|
|||
local afterEach = suite.afterEach
|
||||
|
||||
afterEach(function()
|
||||
client.clearAtoms()
|
||||
client.reset()
|
||||
end)
|
||||
|
||||
test("should sync state payload", function()
|
||||
local a = atom(1)
|
||||
|
||||
client.registerAtoms({ a = a })
|
||||
client.syncAtoms({ a = a })
|
||||
client.applyPayloads({
|
||||
{ type = "init", data = { a = 2 } },
|
||||
})
|
||||
|
|
@ -26,7 +26,7 @@ test("should sync state patch", function()
|
|||
local a = atom({ b = 1, c = 2 })
|
||||
local previous = a()
|
||||
|
||||
client.registerAtoms({ a = a })
|
||||
client.syncAtoms({ a = a })
|
||||
client.applyPayloads({
|
||||
{ type = "init", data = { a = a() } },
|
||||
})
|
||||
|
|
@ -45,7 +45,7 @@ end)
|
|||
test("should fix sparse array patches", function()
|
||||
local a = atom({ 1 })
|
||||
|
||||
client.registerAtoms({ a = a })
|
||||
client.syncAtoms({ a = a })
|
||||
client.applyPayloads({
|
||||
{ type = "init", data = { a = a() } },
|
||||
})
|
||||
|
|
@ -65,7 +65,7 @@ test("should apply multiple patches", function()
|
|||
local a = atom(1)
|
||||
local calls = {}
|
||||
|
||||
client.registerAtoms({ a = a })
|
||||
client.syncAtoms({ a = a })
|
||||
|
||||
subscribe(a, function(value)
|
||||
table.insert(calls, value)
|
||||
|
|
@ -89,7 +89,7 @@ test("should batch patches", function()
|
|||
local b = atom(0)
|
||||
local states = {}
|
||||
|
||||
client.registerAtoms({ a = a, b = b })
|
||||
client.syncAtoms({ a = a, b = b })
|
||||
|
||||
subscribe(a, function()
|
||||
states.b = b()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue