Skip to content

Commit

Permalink
fix tests and deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
tbence94 committed Apr 11, 2023
1 parent 97ea9ed commit 2e92f6d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/QueueMessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ class QueueMessage {
static unserialize (buffer, ContentSchema = JSON) {
if (!ContentSchema || ContentSchema === JSON) {
if (buffer.toString('utf8', 0, 1) === '+') {
const jsonLength = buffer.slice(1, 5).readUInt32BE()
const jsonLength = buffer.subarray(1, 5).readUInt32BE()
const { status, data, timeOut, attachArray } = JSON.parse(buffer.toString('utf8', 5, 5 + jsonLength))
let prevAttachmentLength = 5 + jsonLength
const queueMessage = new this(status, data, timeOut, ContentSchema)
for (const [key, length] of attachArray) {
queueMessage.addAttachment(key, buffer.slice(prevAttachmentLength, prevAttachmentLength + length))
queueMessage.addAttachment(key, buffer.subarray(prevAttachmentLength, prevAttachmentLength + length))
prevAttachmentLength = prevAttachmentLength + length
}

Expand Down
2 changes: 1 addition & 1 deletion test/Gathering.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ describe('GatheringClient && GatheringServer', () => {
if (!response.hasAttachment('test')) {
done(new Error('Missing attachment name "test" from response'))
}
if (!response.getAttachment('test') === buf) {
if (response.getAttachment('test') !== buf) {
done(new Error('Attachment name "test" is not the same'))
}
return msg
Expand Down
2 changes: 1 addition & 1 deletion test/RPC.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ describe('RPCClient && RPCServer', () => {
if (!response.hasAttachment('test')) {
done(new Error('Missing attachment name "test" from response'))
}
if (!response.getAttachment('test') === buf) {
if (response.getAttachment('test') !== buf) {
done(new Error('Attachment name "test" is not the same'))
}
return msg
Expand Down

0 comments on commit 2e92f6d

Please sign in to comment.