Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Fix unit test

Carlos Monastyrski30400691f77f
diff --git a/backend/src/services/certificate-profile/certificate-profile-service.test.ts b/backend/src/services/certificate-profile/certificate-profile-service.test.ts
index d10188e6f8..184dd1980b 100644
--- a/backend/src/services/certificate-profile/certificate-profile-service.test.ts
+++ b/backend/src/services/certificate-profile/certificate-profile-service.test.ts
@@ -5,9 +5,8 @@
import { ForbiddenError } from "@casl/ability";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
-import { TLicenseServiceFactory } from "@app/ee/services/license/license-service";
import type { TPermissionServiceFactory } from "@app/ee/services/permission/permission-service-types";
-import { BadRequestError, ForbiddenRequestError, NotFoundError } from "@app/lib/errors";
+import { ForbiddenRequestError, NotFoundError } from "@app/lib/errors";
import { ActorType, AuthMethod } from "../auth/auth-type";
import type { TCertificateBodyDALFactory } from "../certificate/certificate-body-dal";
@@ -175,10 +174,6 @@ describe("CertificateProfileService", () => {
})
} as unknown as Pick<TPermissionServiceFactory, "getProjectPermission">;
- const mockLicenseService = {
- getPlan: vi.fn()
- } as unknown as Pick<TLicenseServiceFactory, "getPlan">;
-
const mockKmsService = {
encryptWithKmsKey: vi
.fn()
@@ -258,7 +253,6 @@ describe("CertificateProfileService", () => {
certificateAuthorityDAL: mockCertificateAuthorityDAL,
externalCertificateAuthorityDAL: mockExternalCertificateAuthorityDAL,
permissionService: mockPermissionService,
- licenseService: mockLicenseService,
kmsService: mockKmsService,
projectDAL: mockProjectDAL
});
@@ -287,9 +281,6 @@ describe("CertificateProfileService", () => {
id: "project-123",
orgId: "org-123"
});
- (mockLicenseService.getPlan as any).mockResolvedValue({
- pkiAcme: true
- });
(mockCertificateTemplateV2DAL.findById as any).mockResolvedValue(sampleTemplate);
(mockCertificateProfileDAL.findByNameAndProjectId as any).mockResolvedValue(null);
(mockCertificateProfileDAL.findBySlugAndProjectId as any).mockResolvedValue(null);
@@ -423,30 +414,6 @@ describe("CertificateProfileService", () => {
expect(result).toEqual(sampleProfile);
expect(mockCertificateTemplateV2DAL.findById).toHaveBeenCalledWith("template-123");
});
-
- it("should throw BadRequestError when plan does not support ACME", async () => {
- (mockLicenseService.getPlan as any).mockResolvedValue({
- pkiAcme: false
- });
-
- await expect(
- service.createProfile({
- ...mockActor,
- projectId: "project-123",
- data: {
- ...validProfileData,
- enrollmentType: EnrollmentType.ACME,
- acmeConfig: {},
- apiConfig: undefined,
- estConfig: undefined
- }
- })
- ).rejects.toThrowError(
- new BadRequestError({
- message: "Failed to create certificate profile: Plan restriction. Upgrade plan to continue"
- })
- );
- });
});
describe("updateProfile", () => {
@@ -756,9 +723,6 @@ describe("CertificateProfileService", () => {
id: "project-123",
orgId: "org-123"
});
- (mockLicenseService.getPlan as any).mockResolvedValue({
- pkiAcme: true
- });
(mockCertificateTemplateV2DAL.findById as any).mockResolvedValue(sampleTemplate);
(mockCertificateProfileDAL.findByNameAndProjectId as any).mockResolvedValue(null);
(mockCertificateProfileDAL.findBySlugAndProjectId as any).mockResolvedValue(null);