Skip to content

Commit

Permalink
Combine similar tests
Browse files Browse the repository at this point in the history
  • Loading branch information
melanieseltzer committed Aug 31, 2022
1 parent 67b6395 commit 1b5e6a6
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions packages/next-auth/tests/getServerSession.test.ts
Expand Up @@ -45,8 +45,12 @@ describe("Treat secret correctly", () => {
})

it("Error if missing NEXTAUTH_SECRET and secret", async () => {
await unstable_getServerSession(req, res, { providers: [], logger })
const session = await unstable_getServerSession(req, res, {
providers: [],
logger,
})

expect(session).toEqual(null)
expect(logger.error).toBeCalledTimes(1)
expect(logger.error).toBeCalledWith("NO_SECRET", expect.any(MissingSecret))
})
Expand Down Expand Up @@ -85,17 +89,6 @@ describe("Return correct data", () => {
expect(session).toEqual(null)
})

it("Should return null if there is a config error", async () => {
// Forced a `NO_SECRET` error underneath because no secret in the config
// and NEXTAUTH_SECRET doesn't exist either.
const session = await unstable_getServerSession(req, res, {
providers: [],
logger,
})

expect(session).toEqual(null)
})

it("Should return the session if one is found", async () => {
const mockedResponse = {
body: {
Expand Down

0 comments on commit 1b5e6a6

Please sign in to comment.