Skip to content

Commit 303371d

Browse files
committed
Misc
1 parent b1e6e0e commit 303371d

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/token.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,7 @@ function getPayload({
120120
* overwhelming majority of cases.
121121
*/
122122
function tryDetectEnvironment(): void {
123-
if (
124-
typeof navigator !== "undefined" &&
125-
Object.hasOwn(navigator, "userAgent")
126-
) {
123+
if (typeof navigator !== "undefined" && "userAgent" in navigator) {
127124
const { userAgent } = navigator;
128125

129126
if (

tests/token.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,11 +294,13 @@ describe.each([{ permission: "Admin" }])(
294294
).rejects.toHaveProperty("cause.code", "invalid_api_key");
295295
});
296296

297-
test(`${permission} key: Creates tenant token with an expiration date in the past throws an error`, async () => {
297+
test(`${permission} key: Creates tenant token with an expiration date as UNIX timestamp in the past throws an error`, async () => {
298298
const client = await getClient(permission);
299299
const apiKey = await getKey(permission);
300300
const { uid } = await client.getKey(apiKey);
301-
const date = new Date("December 17, 2000 03:24:00");
301+
const date = Math.floor(
302+
new Date("December 17, 2000 03:24:00").getTime() / 1000,
303+
);
302304

303305
const token = await generateTenantToken({
304306
apiKey,

0 commit comments

Comments
 (0)