Fix/accept team invite once signup (#1653)

* Accept team invite once signup

* Add expectations for the team invite

Co-authored-by: Miguel Nieto A <[email protected]>
This commit is contained in:
Alex van AndelandMiguel Nieto A authored and GitHub committed 2022-01-29 18:56:40 +00:00
1 parent 2079199bab
commit 9dc45071c5
2 files changed
+27 -1

No files matched your search

+14
View File
@@ -94,11 +94,25 @@ test.describe("Can signup from a team invite", async () => {
const createdUser = await prisma.user.findUnique({
where: { email: testUser.email },
include: {
teams: {
include: {
team: true,
},
},
},
});
// Check that the user was created
expect(createdUser).not.toBeNull();
expect(createdUser?.username).toBe(testUser.validUsername);
expect(createdUser?.password).not.toBeNull();
expect(createdUser?.emailVerified).not.toBeNull();
// Check that the user accepted the team invite
expect(createdUser?.teams).toHaveLength(1);
expect(createdUser?.teams[0].team.name).toBe(team.name);
expect(createdUser?.teams[0].team.slug).toBe(team.slug);
expect(createdUser?.teams[0].role).toBe("MEMBER");
expect(createdUser?.teams[0].accepted).toBe(true);
});
});