-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ed335e3
commit ceec592
Showing
19 changed files
with
442 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
import login from "@architect/shared/lambda/oauth/handlers/login" | ||
import loginHandlerFactory from "@architect/shared/lambda/oauth/handlers/login" | ||
import userRepositoryFactory from "@architect/shared/lambda/oauth/repository/UserRepository" | ||
|
||
export const handler = login | ||
export const handler = loginHandlerFactory(userRepositoryFactory()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
import { writeSessionID, readSessionID } from "./session" | ||
import { writeSessionID, readSessionID, UserSession, createAnonymousSessionID } from "./session" | ||
import { createMockRequest } from "../../../../test/support/lambda" | ||
import { randomInt } from "../../../../test/support" | ||
|
||
describe("session", () => { | ||
let testSessionID = "" | ||
let testSesson: UserSession | ||
|
||
beforeEach(() => { | ||
testSessionID = "session-id-" + randomInt().toString() | ||
testSesson = createAnonymousSessionID() | ||
}) | ||
|
||
it("should add and read the same session id", async () => { | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
const response: any = {} | ||
writeSessionID(response, testSessionID) | ||
writeSessionID(response, testSesson) | ||
expect(response).toHaveProperty("cookies") | ||
// steal the cookie for the read test: | ||
const stolenCookie = response.cookies[0] | ||
|
||
// read it: | ||
const req = createMockRequest({ cookies: [stolenCookie] }) | ||
const found = readSessionID(req) | ||
expect(found).toStrictEqual(testSessionID) | ||
expect(found).toStrictEqual(testSesson) | ||
}) | ||
}) |
Oops, something went wrong.