Skip to content

Commit

Permalink
add test for login
Browse files Browse the repository at this point in the history
  • Loading branch information
harishv7 committed Jan 15, 2025
1 parent b2b72bc commit ec1a0a8
Showing 1 changed file with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
applySession,
createMockRequest,
} from "tests/integration/helpers/iron-session"
import { setUpWhitelist } from "tests/integration/helpers/seed"
import { setupUser, setUpWhitelist } from "tests/integration/helpers/seed"
import { describe, expect, it } from "vitest"

import { env } from "~/env.mjs"
Expand Down Expand Up @@ -71,6 +71,25 @@ describe("auth.email", () => {
})
expect(result).toEqual(expectedReturn)
})

it("should throw if user is deleted", async () => {
// Arrange
await setupUser({
name: "Deleted",
userId: "deleted123",
email: TEST_VALID_EMAIL,
phone: "123",
isDeleted: true,
})

// Act
const result = caller.login({ email: TEST_VALID_EMAIL })

// Assert
await expect(result).rejects.toThrowError(
"Unauthorized. Contact Isomer support.",
)
})
})

describe("verifyOtp", () => {
Expand Down

0 comments on commit ec1a0a8

Please sign in to comment.