mirror of
https://github.com/lukevella/rallly.git
synced 2025-07-29 06:07:25 +02:00
🐛 Fix user test utils (#1824)
This commit is contained in:
parent
1284b0ac04
commit
d93615befe
1 changed files with 28 additions and 9 deletions
|
@ -11,15 +11,34 @@ export async function createUserInDb({
|
|||
name: string;
|
||||
role?: UserRole;
|
||||
}) {
|
||||
return prisma.user.create({
|
||||
data: {
|
||||
email,
|
||||
name,
|
||||
role,
|
||||
locale: "en",
|
||||
timeZone: "Europe/London",
|
||||
emailVerified: new Date(),
|
||||
},
|
||||
return await prisma.$transaction(async (tx) => {
|
||||
const user = await tx.user.create({
|
||||
data: {
|
||||
email,
|
||||
name,
|
||||
role,
|
||||
locale: "en",
|
||||
timeZone: "Europe/London",
|
||||
emailVerified: new Date(),
|
||||
},
|
||||
});
|
||||
|
||||
const space = await tx.space.create({
|
||||
data: {
|
||||
name: "Personal",
|
||||
ownerId: user.id,
|
||||
},
|
||||
});
|
||||
|
||||
await tx.spaceMember.create({
|
||||
data: {
|
||||
spaceId: space.id,
|
||||
userId: user.id,
|
||||
role: "OWNER",
|
||||
},
|
||||
});
|
||||
|
||||
return user;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue