Feat: add auth provider to users on sign in (#3739)

* feat: merge a new authentication method onto existing user records when emails match

* adds test for invite acceptance and auth provider creation

* addresses comments
- test existing user and invites in different test cases
- update lastActiveAt syncronously when an invite is accepted

* sort arrays in test to prevent nondeterministic test behaivior when doing array compare
This commit is contained in:
Nan Yu
2022-07-08 00:24:46 -07:00
committed by GitHub
parent ec8c0645ba
commit 1e808fc52c
4 changed files with 125 additions and 37 deletions

View File

@@ -39,7 +39,7 @@ describe("#team.update", () => {
});
const body = await res.json();
expect(res.status).toEqual(200);
expect(body.data.allowedDomains).toEqual([
expect(body.data.allowedDomains.sort()).toEqual([
"example-company.com",
"example-company.org",
]);
@@ -47,7 +47,7 @@ describe("#team.update", () => {
const teamDomains: TeamDomain[] = await TeamDomain.findAll({
where: { teamId: team.id },
});
expect(teamDomains.map((d) => d.name)).toEqual([
expect(teamDomains.map((d) => d.name).sort()).toEqual([
"example-company.com",
"example-company.org",
]);