From 3529b7287d84627922c5bf7bb4c6e20a1efd2c2b Mon Sep 17 00:00:00 2001 From: George B <705427+georgeblahblah@users.noreply.github.com> Date: Thu, 18 Jan 2024 13:54:24 +0000 Subject: [PATCH] Handle `undefined` in buffer --- .../src/test/resources/decode-encode/decode-encode.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scrooge-generator-typescript/src/test/resources/decode-encode/decode-encode.ts b/scrooge-generator-typescript/src/test/resources/decode-encode/decode-encode.ts index 51c7c34..45485c0 100644 --- a/scrooge-generator-typescript/src/test/resources/decode-encode/decode-encode.ts +++ b/scrooge-generator-typescript/src/test/resources/decode-encode/decode-encode.ts @@ -41,7 +41,11 @@ async function decode(buffer: Buffer): Promise { async function encode(school: School): Promise { return new Promise((resolve, reject) => { const outputBufferTransport = new TBufferedTransport(undefined, (buffer, seqId) => { - resolve(buffer); + if (buffer !== undefined) { + resolve(buffer); + } else { + reject(); + } }); const outputProtocol = new TCompactProtocol(outputBufferTransport); SchoolSerde.write(outputProtocol, school);