From e53baca392d425604ff5875fa657d45536c73c0c Mon Sep 17 00:00:00 2001 From: bandhan-majumder Date: Mon, 10 Mar 2025 07:26:14 +0530 Subject: [PATCH] fix(test): improve coverage --- tests/utilities/auth.spec.ts | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/tests/utilities/auth.spec.ts b/tests/utilities/auth.spec.ts index 5edffa811bf..1c8abfb88ea 100644 --- a/tests/utilities/auth.spec.ts +++ b/tests/utilities/auth.spec.ts @@ -2,7 +2,7 @@ import jwt from "jsonwebtoken"; import type mongoose from "mongoose"; import { afterAll, beforeAll, describe, expect, it, vi } from "vitest"; import type { InterfaceAppUserProfile, InterfaceUser } from "../../src/models"; -import { AppUserProfile, Community, User } from "../../src/models"; +import { AppUserProfile, Community } from "../../src/models"; import { createAccessToken, createRefreshToken, @@ -231,18 +231,4 @@ describe("revokeRefreshToken", () => { expect(updateAppUserProfile?.token).toBeUndefined(); }); - - it("should do nothing if the user does not exist", async () => { - const findOneSpy = vi.spyOn(User, "findOne").mockResolvedValueOnce(null); - const findOneAndUpdateSpy = vi.spyOn(User, "findOneAndUpdate"); - - const nonExistentUserId = "60c72b2f9b1d8a3e9c8d1234"; // Non-existent user ID - await revokeRefreshToken(nonExistentUserId); - - expect(findOneSpy).toHaveBeenCalledWith({ _id: nonExistentUserId }); - expect(findOneAndUpdateSpy).not.toHaveBeenCalled(); - - findOneSpy.mockRestore(); - findOneAndUpdateSpy.mockRestore(); - }); });