Skip to content

Commit

Permalink
format code
Browse files Browse the repository at this point in the history
  • Loading branch information
mikedebock committed Mar 11, 2024
1 parent 0543c6f commit c8ee68f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 18 deletions.
23 changes: 11 additions & 12 deletions src/tokensource/cookies.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,14 @@ const createMockResponse = () => {
};

describe("CookieTokenSource", () => {

it("should use default cookie names", () => {
const cookieTokenSource = new CookieTokenSource({
secure: false,
sameSite: "strict",
refreshTokenPath: "/refresh",
});

const result = cookieTokenSource['cookieNames']
const result = cookieTokenSource["cookieNames"];
expect(result).toStrictEqual({
accessToken: "authToken",
accessTokenHash: "authTokenHash",
Expand All @@ -43,19 +42,19 @@ describe("CookieTokenSource", () => {
sameSite: "strict",
refreshTokenPath: "/refresh",
cookieNames: {
accessToken: 'accessToken-overridden',
accessTokenHash: 'accessTokenHash-overridden',
refreshToken: 'refreshToken-overridden',
refreshTokenExist: 'refreshTokenExist-overridden'
}
accessToken: "accessToken-overridden",
accessTokenHash: "accessTokenHash-overridden",
refreshToken: "refreshToken-overridden",
refreshTokenExist: "refreshTokenExist-overridden",
},
});

const result = cookieTokenSource['cookieNames']
const result = cookieTokenSource["cookieNames"];
expect(result).toStrictEqual({
accessToken: 'accessToken-overridden',
accessTokenHash: 'accessTokenHash-overridden',
refreshToken: 'refreshToken-overridden',
refreshTokenExist: 'refreshTokenExist-overridden'
accessToken: "accessToken-overridden",
accessTokenHash: "accessTokenHash-overridden",
refreshToken: "refreshToken-overridden",
refreshTokenExist: "refreshTokenExist-overridden",
});
});

Expand Down
12 changes: 6 additions & 6 deletions src/tokensource/cookies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ import { CookieOptions, Request, Response } from "express";
import { TokenSource } from "./base";

type CookieNames = {
accessToken: string
accessTokenHash: string
refreshToken: string
refreshTokenExist: string
}
accessToken: string;
accessTokenHash: string;
refreshToken: string;
refreshTokenExist: string;
};

type CookieSourceOptions = {
secure: boolean;
sameSite: CookieOptions["sameSite"];
refreshTokenPath: string;
cookieNames?: CookieNames
cookieNames?: CookieNames;
publicDomainFn?: (request: Request) => string | undefined;
privateDomainFn?: (request: Request) => string | undefined;
};
Expand Down

0 comments on commit c8ee68f

Please sign in to comment.