-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add tests and handling for deleted users (#953)
* add tests for soft delete * add tests for list site * add test for login * fix pr comments * default values for non-essential fields
- Loading branch information
Showing
4 changed files
with
115 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
apps/studio/src/server/modules/user/__tests__/user.service.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { resetTables } from "tests/integration/helpers/db" | ||
import { setupUser } from "tests/integration/helpers/seed" | ||
|
||
import { isUserDeleted } from "../user.service" | ||
|
||
describe("user.service", () => { | ||
beforeAll(async () => { | ||
await resetTables("User") | ||
}) | ||
|
||
it("should return false if user is not deleted", async () => { | ||
// Arrange | ||
const email = "[email protected]" | ||
// Setup active user | ||
await setupUser({ | ||
email: email, | ||
isDeleted: false, | ||
}) | ||
|
||
// Act | ||
const result = await isUserDeleted(email) | ||
// Assert | ||
expect(result).toBe(false) | ||
}) | ||
|
||
it("should return true if user is deleted", async () => { | ||
// Arrange | ||
const email = "[email protected]" | ||
// Setup deleted user | ||
await setupUser({ | ||
email: email, | ||
isDeleted: true, | ||
}) | ||
|
||
// Act | ||
const result = await isUserDeleted(email) | ||
// Assert | ||
expect(result).toBe(true) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters