Skip to content

Commit

Permalink
Merge branch 'main' into FE-6088
Browse files Browse the repository at this point in the history
  • Loading branch information
ecooper authored Nov 4, 2024
2 parents 61943dd + 19458fe commit 340755a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
12 changes: 12 additions & 0 deletions __tests__/functional/feed-client-configuration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,16 @@ describe("FeedClientConfiguration", () => {
expect(e).toBeInstanceOf(RangeError);
}
});

it("throws a TypeError if 'cursor' is not a string", async () => {
const config = { ...defaultConfig, cursor: null };
try {
new FeedClient(
dummyStreamToken,
config as unknown as FeedClientConfiguration,
);
} catch (e: any) {
expect(e).toBeInstanceOf(TypeError);
}
});
});
4 changes: 4 additions & 0 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1143,6 +1143,10 @@ export class FeedClient<T extends QueryValue = any> {
"Only one of 'start_ts' or 'cursor' can be defined in the client configuration.",
);
}

if (config.cursor !== undefined && typeof config.cursor !== "string") {
throw new TypeError("'cursor' must be a string.");
}
}
}

Expand Down

0 comments on commit 340755a

Please sign in to comment.