From 8aef95e2ae066b29b478a9b9837c9b730fa494db Mon Sep 17 00:00:00 2001 From: Richard Date: Wed, 25 Sep 2024 22:10:04 -0700 Subject: [PATCH] build: update dev config --- dev.project.json | 9 ++++----- src/__tests__/sync/client.spec.luau | 22 ++++++++++++++++++++++ testez-companion.toml | 2 +- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/dev.project.json b/dev.project.json index ed0d1b9..6b6d807 100644 --- a/dev.project.json +++ b/dev.project.json @@ -4,12 +4,11 @@ "$className": "DataModel", "ReplicatedStorage": { "$className": "ReplicatedStorage", - "Packages": { - "$path": "Packages", - "ReactLua": { "$path": "Packages" }, - "charm": { "$path": "src" } + "DevPackages": { + "$path": "DevPackages", + "Charm": { "$path": "src" } }, - "DevPackages": { "$path": "DevPackages" } + "Packages": { "$path": "Packages" } }, "TestService": { "$className": "TestService", diff --git a/src/__tests__/sync/client.spec.luau b/src/__tests__/sync/client.spec.luau index afea44e..90c128a 100644 --- a/src/__tests__/sync/client.spec.luau +++ b/src/__tests__/sync/client.spec.luau @@ -20,6 +20,13 @@ return function() local previous = a() local client = sync.client({ atoms = { a = a } }) + client:sync({ + type = "init", + data = { a = a() }, + }) + + expect(a()).to.equal(previous) + client:sync({ type = "patch", data = { a = { b = 3 } }, @@ -34,6 +41,11 @@ return function() local a = atom({ 1 }) local client = sync.client({ atoms = { a = a } }) + client:sync({ + type = "init", + data = { a = a() }, + }) + -- This patch would be the result of a diff between { 1 } and { 1, 2 } that -- was JSON-serialized and deserialized. The client should be able to catch -- this and convert the string key back to a number. @@ -55,6 +67,11 @@ return function() table.insert(calls, value) end) + client:sync({ + type = "init", + data = { a = a() }, + }) + client:sync({ type = "patch", data = { a = 2 }, @@ -82,6 +99,11 @@ return function() states.a = a() end) + client:sync({ + type = "init", + data = { a = a(), b = b() }, + }) + client:sync({ type = "patch", data = { a = 1, b = 2 }, diff --git a/testez-companion.toml b/testez-companion.toml index bb50d4d..cc9ae64 100644 --- a/testez-companion.toml +++ b/testez-companion.toml @@ -1 +1 @@ -roots = ["ReplicatedStorage/Packages/charm/__tests__"] +roots = ["ReplicatedStorage/DevPackages/Charm/__tests__"]