-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: parse action and provider id * delete unused file * use basePath in parseProviders * use basePath for error redirects * throw error with invalid signin url (GET with providerId) * fix test * fix tests
- Loading branch information
1 parent
60cb83e
commit 963086b
Showing
9 changed files
with
124 additions
and
71 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
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 was deleted.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { describe, expect, it } from "vitest" | ||
|
||
import { parseActionAndProviderId } from "../src/lib/utils/web" | ||
import { UnknownAction } from "../src/errors" | ||
|
||
describe("parse the action and provider id", () => { | ||
it.each([ | ||
{ | ||
path: "/auuth/signin", | ||
error: "Cannot parse action at /auuth/signin", | ||
basePath: "/auth", | ||
}, | ||
{ | ||
path: "/api/auth/signin", | ||
error: "Cannot parse action at /api/auth/signin", | ||
basePath: "/auth", | ||
}, | ||
{ | ||
path: "/auth/auth/signin/github", | ||
error: "Cannot parse action at /auth/auth/signin/github", | ||
basePath: "/auth", | ||
}, | ||
{ | ||
path: "/api/auth/signinn", | ||
error: "Cannot parse action at /api/auth/signinn", | ||
basePath: "/api/auth", | ||
}, | ||
{ | ||
path: "/api/auth/signinn/github", | ||
error: "Cannot parse action at /api/auth/signinn/github", | ||
basePath: "/api/auth", | ||
}, | ||
{ | ||
path: "/api/auth/signin/github", | ||
action: "signin", | ||
providerId: "github", | ||
basePath: "/api/auth", | ||
}, | ||
{ | ||
path: "/api/auth/signin/github/github", | ||
error: "Cannot parse action at /api/auth/signin/github/github", | ||
basePath: "/api/auth", | ||
}, | ||
{ | ||
path: "/api/auth/signin/api/auth/signin/github", | ||
error: "Cannot parse action at /api/auth/signin/api/auth/signin/github", | ||
basePath: "/api/auth", | ||
}, | ||
])("$path", ({ path, error, basePath, action, providerId }) => { | ||
if (action || providerId) { | ||
const parsed = parseActionAndProviderId(path, basePath) | ||
expect(parsed.action).toBe(action) | ||
expect(parsed.providerId).toBe(providerId) | ||
} else { | ||
expect(() => parseActionAndProviderId(path, basePath)).toThrow( | ||
new UnknownAction(error) | ||
) | ||
} | ||
}) | ||
}) |
963086b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
auth-docs – ./docs
errors.authjs.dev
next-auth-docs-m1mt.vercel.app
www.authjs.dev
warnings.authjs.dev
authjs.dev
express.authjs.dev
adapters.authjs.dev
sveltekit.authjs.dev
nextjs.authjs.dev
providers.authjs.dev
auth-docs-authjs.vercel.app
auth-docs-git-main-authjs.vercel.app