mirror of
https://github.com/zap-proto/zap-es.git
synced 2026-10-30 15:02:55 +00:00
21 lines
532 B
TypeScript
21 lines
532 B
TypeScript
// Based on https://github.com/jdiaz5513/capnp-ts (MIT - Julián Díaz)
|
|
|
|
import { test } from "vitest";
|
|
|
|
import * as zap from "zap-es";
|
|
|
|
import { Foo as OldFoo } from "../fixtures/foo.ts";
|
|
import { Foo as NewFoo } from "../fixtures/foo-new.ts";
|
|
|
|
test("foo regression", () => {
|
|
const oldMessage = new zap.Message();
|
|
const oldFoo = oldMessage.initRoot(OldFoo);
|
|
|
|
oldFoo.bar = "bar";
|
|
|
|
const packed = Buffer.from(oldMessage.toPackedArrayBuffer());
|
|
|
|
const newMessage = new zap.Message(packed);
|
|
newMessage.getRoot(NewFoo);
|
|
});
|