feat: Add support for mapped providers to kv_oauth plugin (#1792)

This commit is contained in:
Ben
2023-09-18 19:54:14 +00:00
committed by GitHub
parent b6eb518092
commit 58b2bd9e7f
2 changed files with 119 additions and 8 deletions
+14
View File
@@ -36,4 +36,18 @@ Deno.test("kvOAuthPlugin() works correctly", async (test) => {
signOutPath,
]);
});
await test.step("with mapped providers", () => {
const providerKey = "customProvider";
const plugin = kvOAuthPlugin({
[providerKey]: oauth2Client,
});
assertNotEquals(plugin.routes, undefined);
assert(plugin.routes!.every((route) => route.handler !== undefined));
assertArrayIncludes(plugin.routes!.map((route) => route.path), [
`/oauth/${providerKey}/signin`,
`/oauth/${providerKey}/callback`,
`/oauth/${providerKey}/signout`,
]);
});
});