From 3d7ee22f881996401cbc6c2f5b9c995957f0937c Mon Sep 17 00:00:00 2001 From: khtsly Date: Fri, 13 Feb 2026 17:46:44 +0700 Subject: [PATCH] chore(test): fix buffer test unit for write/read events --- sourcemap.json | 2 +- test/buffer.spec.luau | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/sourcemap.json b/sourcemap.json index d55fdfc..c47c212 100644 --- a/sourcemap.json +++ b/sourcemap.json @@ -1 +1 @@ -{"name":"Warp","className":"ModuleScript","filePaths":["src/init.luau","default.project.json"],"children":[{"name":"Client","className":"ModuleScript","filePaths":["src/Client/init.luau"]},{"name":"Server","className":"ModuleScript","filePaths":["src/Server/init.luau"]},{"name":"Util","className":"Folder","children":[{"name":"Buffer","className":"ModuleScript","filePaths":["src/Util/Buffer/init.luau"]},{"name":"Thread","className":"ModuleScript","filePaths":["src/Util/Thread.luau"]},{"name":"Identifier","className":"ModuleScript","filePaths":["src/Util/Identifier.luau"]}]}]} \ No newline at end of file +{"name":"Warp","className":"ModuleScript","filePaths":["src/init.luau","default.project.json"],"children":[{"name":"Client","className":"ModuleScript","filePaths":["src/Client/init.luau"]},{"name":"Server","className":"ModuleScript","filePaths":["src/Server/init.luau"]},{"name":"Util","className":"Folder","children":[{"name":"Buffer","className":"ModuleScript","filePaths":["src/Util/Buffer/init.luau"]},{"name":"Identifier","className":"ModuleScript","filePaths":["src/Util/Identifier.luau"]},{"name":"Thread","className":"ModuleScript","filePaths":["src/Util/Thread.luau"]}]}]} \ No newline at end of file diff --git a/test/buffer.spec.luau b/test/buffer.spec.luau index d30cac9..f3479f9 100644 --- a/test/buffer.spec.luau +++ b/test/buffer.spec.luau @@ -920,34 +920,34 @@ return function() it("encodes/decodes event batches (writeEvents/readEvents), with and without schemas", function() local S = Buffer.Schema local schemas = { - MyRemote = S.struct({ + [1] = S.struct({ -- this defined in id since remoteName (string) will be converted into integer (u8) through Identifier count = S.u8, msg = S.string, }), } - + local payload = { count = 7, msg = "hello", } - + local events = { - { "MyRemote", { payload } }, - { "OtherRemote", { 1, 2 } }, + { 1, { payload } }, + { 2, { 1, 2 } }, } - + local w = Buffer.createWriter() Buffer.writeEvents(w, events, schemas) local buf, refs = Buffer.buildWithRefs(w) - + local decoded = Buffer.readEvents(buf, refs, schemas) expect(#decoded).to.equal(2) - - expect(decoded[1][1]).to.equal("MyRemote") + + expect(decoded[1][1]).to.equal(1) expect(decoded[1][2][1].count).to.equal(7) expect(decoded[1][2][1].msg).to.equal("hello") - - expect(decoded[2][1]).to.equal("OtherRemote") + + expect(decoded[2][1]).to.equal(2) expect(decoded[2][2][1]).to.equal(1) expect(decoded[2][2][2]).to.equal(2) end)