next-auth-dynamodb
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -58,8 +58,11 @@ "use strict"; | ||
const { email, emailVerified, name, image } = profile; | ||
const savedUser = await UserStore.create({ | ||
const user = { | ||
email, | ||
emailVerified, | ||
name, | ||
image, | ||
}); | ||
}; | ||
if (emailVerified !== undefined) { | ||
user.emailVerified = emailVerified; | ||
} | ||
const savedUser = await UserStore.create(user); | ||
log("createUser", { savedUser }); | ||
@@ -66,0 +69,0 @@ return savedUser; |
{ | ||
"name": "next-auth-dynamodb", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"contributors": [ | ||
@@ -5,0 +5,0 @@ "Tom Andrews <git@tomandrews.co.uk>" |
@@ -24,2 +24,14 @@ import Omanyd from "omanyd"; | ||
it("should not blow up if the user email verify state is unknown", async () => { | ||
const adapter = await nextAuthDynamodb.getAdapter(opts); | ||
const savedUser = await adapter.createUser({ | ||
email: "foo@bar.com", | ||
name: "Foo Bar", | ||
image: "foo.png", | ||
}); | ||
const readUser = await adapter.getUserByEmail("foo@bar.com"); | ||
expect(readUser).toStrictEqual(savedUser); | ||
expect(readUser.emailVerified).toBeUndefined(); | ||
}); | ||
it("should return the created user by id", async () => { | ||
@@ -26,0 +38,0 @@ const adapter = await nextAuthDynamodb.getAdapter(opts); |
@@ -14,3 +14,3 @@ import type { Adapter } from "next-auth/adapters"; | ||
image: string; | ||
emailVerified: boolean; | ||
emailVerified?: boolean; | ||
} | ||
@@ -60,3 +60,3 @@ | ||
image: string; | ||
emailVerified: boolean; | ||
emailVerified?: boolean; | ||
} | ||
@@ -99,8 +99,11 @@ | ||
const { email, emailVerified, name, image } = profile; | ||
const savedUser = await UserStore.create({ | ||
const user: Omit<User, "id"> = { | ||
email, | ||
emailVerified, | ||
name, | ||
image, | ||
}); | ||
}; | ||
if (emailVerified !== undefined) { | ||
user.emailVerified = emailVerified; | ||
} | ||
const savedUser = await UserStore.create(user); | ||
log("createUser", { savedUser }); | ||
@@ -107,0 +110,0 @@ return savedUser; |
26474
594