Skip to content

Commit

Permalink
Addressed review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Yi-Pin Chen <[email protected]>
  • Loading branch information
yipin-chen committed Sep 4, 2024
1 parent 45fce14 commit 1ad9408
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions node/src/BaseClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -951,19 +951,21 @@ export class BaseClient {
let msg: PubSubMsg | null = null;
const responsePointer = pushNotification.respPointer;
let nextPushNotificationValue: Record<string, unknown> = {};
const isStringDecoder =
(decoder ?? this.defaultDecoder) === Decoder.String;

if (responsePointer) {
if (typeof responsePointer !== "number") {
nextPushNotificationValue = valueFromSplitPointer(
responsePointer.high,
responsePointer.low,
(decoder ?? this.defaultDecoder) === Decoder.String,
isStringDecoder,
) as Record<string, unknown>;
} else {
nextPushNotificationValue = valueFromSplitPointer(
0,
responsePointer,
(decoder ?? this.defaultDecoder) === Decoder.String,
isStringDecoder,
) as Record<string, unknown>;
}

Expand Down
6 changes: 3 additions & 3 deletions node/tests/PubSub.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ describe("PubSub", () => {

expect(pubsubMessage!.message).toEqual(message);
expect(pubsubMessage!.channel).toEqual(channel);
expect(pubsubMessage!.pattern).toEqual(null);
expect(pubsubMessage!.pattern).toBeNull();

await checkNoMessagesLeft(method, listeningClient, context, 1);
} finally {
Expand All @@ -389,7 +389,7 @@ describe("PubSub", () => {
);

/**
* Tests the basic happy path for exact PUBSUB functionality with binary decoder.
* Tests the basic happy path for exact PUBSUB functionality with binary.
*
* This test covers the basic PUBSUB flow using three different methods:
* Async, Sync, and Callback. It verifies that a message published to a
Expand Down Expand Up @@ -460,7 +460,7 @@ describe("PubSub", () => {

expect(pubsubMessage!.message).toEqual(Buffer.from(message));
expect(pubsubMessage!.channel).toEqual(Buffer.from(channel));
expect(pubsubMessage!.pattern).toEqual(null);
expect(pubsubMessage!.pattern).toBeNull();

await checkNoMessagesLeft(method, listeningClient, context, 1);
} finally {
Expand Down

0 comments on commit 1ad9408

Please sign in to comment.