fix: Improved handling of authentication edge-cases (#2023)

* fix: authentication records not cleaned up for deleted user
closes #2022

* fix: Improve debugging for duplicate providerId sign-in requests
This commit is contained in:
Tom Moor
2021-04-11 19:39:31 -07:00
committed by GitHub
parent bc4fe05147
commit 62f9262b2c
4 changed files with 92 additions and 5 deletions

View File

@ -1,11 +1,21 @@
// @flow
import { CollectionUser } from "../models";
import { UserAuthentication, CollectionUser } from "../models";
import { buildUser, buildTeam, buildCollection } from "../test/factories";
import { flushdb } from "../test/support";
beforeEach(() => flushdb());
describe("user model", () => {
describe("destroy", () => {
it("should delete user authentications", async () => {
const user = await buildUser();
expect(await UserAuthentication.count()).toBe(1);
await user.destroy();
expect(await UserAuthentication.count()).toBe(0);
});
});
describe("getJwtToken", () => {
it("should set JWT secret", async () => {
const user = await buildUser();