chore(test): update buffer test

This commit is contained in:
khtsly 2026-02-16 17:31:13 +07:00
parent 1200ff41f1
commit bb120bfbef

View file

@ -925,28 +925,28 @@ return function()
msg = S.string, msg = S.string,
}), }),
} }
local payload = { local payload = {
count = 7, count = 7,
msg = "hello", msg = "hello",
} }
local events = { local events = {
{ 1, { payload } }, { 1, { payload } },
{ 2, { 1, 2 } }, { 2, { 1, 2 } },
} }
local w = Buffer.createWriter() local w = Buffer.createWriter()
Buffer.writeEvents(w, events, schemas) Buffer.writeEvents(w, events, schemas)
local buf, refs = Buffer.buildWithRefs(w) local buf, refs = Buffer.buildWithRefs(w)
local decoded = Buffer.readEvents(buf, refs, schemas) local decoded = Buffer.readEvents(buf, refs, schemas)
expect(#decoded).to.equal(2) expect(#decoded).to.equal(2)
expect(decoded[1][1]).to.equal(1) expect(decoded[1][1]).to.equal(1)
expect(decoded[1][2][1].count).to.equal(7) expect(decoded[1][2][1].count).to.equal(7)
expect(decoded[1][2][1].msg).to.equal("hello") expect(decoded[1][2][1].msg).to.equal("hello")
expect(decoded[2][1]).to.equal(2) expect(decoded[2][1]).to.equal(2)
expect(decoded[2][2][1]).to.equal(1) expect(decoded[2][2][1]).to.equal(1)
expect(decoded[2][2][2]).to.equal(2) expect(decoded[2][2][2]).to.equal(2)