feat: prepare for alpha release

This commit is contained in:
littensy 2025-10-02 01:43:28 -07:00
parent 5a05f01223
commit f5709c3112
10 changed files with 251 additions and 54 deletions

View file

@ -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()

View file

@ -9,7 +9,7 @@ local test = suite.test
afterEach(function()
server.reset()
client.clearAtoms()
client.reset()
config.preserveHistory = false
end)
@ -20,7 +20,7 @@ test("should replicate server state to client", function()
local clientA = Charm.atom({ count = -1 })
local clientB = Charm.atom({ count = -1 })
client.registerAtoms({ a = clientA, b = clientB })
client.syncAtoms({ a = clientA, b = clientB })
server.syncAtomsToClient(target, { a = serverA, b = serverB })
server.startSync(function(syncTarget, payloads)
if syncTarget == target then
@ -54,7 +54,7 @@ test("should replicate historical server state to client", function()
config.preserveHistory = true
client.registerAtoms({ a = clientA, b = clientB })
client.syncAtoms({ a = clientA, b = clientB })
server.syncAtomsToClient(target, { a = serverA, b = serverB })
server.startSync(function(syncTarget, payloads)
if syncTarget == target then