Skip to content

Commit

Permalink
SPRXCLT-12: improve buffer accumulation in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Florent Monjalet committed Aug 4, 2023
1 parent 37c588f commit c6003c8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tests/unit/sproxyd.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,16 @@ function _batchDelKeys(n) {

function checkKeyContent(client, key, body, reqUid, callback) {
client.get(key, undefined, reqUid, (err, stream) => {
let ret = Buffer.alloc(0);
const chunks = []
if (err) {
done(err);
} else {
stream.on('data', val => {
ret = Buffer.concat([ret, val]);
chunks.push(val);
});
stream.on('end', () => {
assert.deepStrictEqual(ret, body);
let buf = Buffer.concat(chunks)
assert.deepStrictEqual(buf, body);
callback();
});
}
Expand Down

0 comments on commit c6003c8

Please sign in to comment.