Skip to content

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

misc: fixed tests

Sheen Capadngan7d65ca7a9c72
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 ffca3c1cbb..9d9ab5947c 100644
--- a/backend/src/services/certificate-profile/certificate-profile-service.test.ts
+++ b/backend/src/services/certificate-profile/certificate-profile-service.test.ts
@@ -9,6 +9,10 @@ import type { TPermissionServiceFactory } from "@app/ee/services/permission/perm
import { ForbiddenRequestError, NotFoundError } from "@app/lib/errors";
import { ActorType, AuthMethod } from "../auth/auth-type";
+import type { TCertificateBodyDALFactory } from "../certificate/certificate-body-dal";
+import type { TCertificateSecretDALFactory } from "../certificate/certificate-secret-dal";
+import type { TCertificateAuthorityCertDALFactory } from "../certificate-authority/certificate-authority-cert-dal";
+import type { TCertificateAuthorityDALFactory } from "../certificate-authority/certificate-authority-dal";
import type { TCertificateTemplateV2DALFactory } from "../certificate-template-v2/certificate-template-v2-dal";
import { TAcmeEnrollmentConfigDALFactory } from "../enrollment-config/acme-enrollment-config-dal";
import type { TApiEnrollmentConfigDALFactory } from "../enrollment-config/api-enrollment-config-dal";
@@ -178,6 +182,54 @@ describe("CertificateProfileService", () => {
transaction: vi.fn()
} as unknown as Pick<TProjectDALFactory, "findProjectBySlug" | "findOne" | "updateById" | "findById" | "transaction">;
+ const mockCertificateBodyDAL = {
+ create: vi.fn(),
+ findById: vi.fn(),
+ updateById: vi.fn(),
+ deleteById: vi.fn(),
+ transaction: vi.fn(),
+ find: vi.fn(),
+ findOne: vi.fn(),
+ update: vi.fn(),
+ delete: vi.fn()
+ } as unknown as TCertificateBodyDALFactory;
+
+ const mockCertificateSecretDAL = {
+ create: vi.fn(),
+ findById: vi.fn(),
+ updateById: vi.fn(),
+ deleteById: vi.fn(),
+ transaction: vi.fn(),
+ find: vi.fn(),
+ findOne: vi.fn(),
+ update: vi.fn(),
+ delete: vi.fn()
+ } as unknown as TCertificateSecretDALFactory;
+
+ const mockCertificateAuthorityDAL = {
+ create: vi.fn(),
+ findById: vi.fn(),
+ updateById: vi.fn(),
+ deleteById: vi.fn(),
+ transaction: vi.fn(),
+ find: vi.fn(),
+ findOne: vi.fn(),
+ update: vi.fn(),
+ delete: vi.fn()
+ } as unknown as TCertificateAuthorityDALFactory;
+
+ const mockCertificateAuthorityCertDAL = {
+ create: vi.fn(),
+ findById: vi.fn(),
+ updateById: vi.fn(),
+ deleteById: vi.fn(),
+ transaction: vi.fn(),
+ find: vi.fn(),
+ findOne: vi.fn(),
+ update: vi.fn(),
+ delete: vi.fn()
+ } as unknown as TCertificateAuthorityCertDALFactory;
+
beforeEach(() => {
vi.spyOn(ForbiddenError, "from").mockReturnValue({
throwUnlessCan: vi.fn()
@@ -195,6 +247,10 @@ describe("CertificateProfileService", () => {
apiEnrollmentConfigDAL: mockApiEnrollmentConfigDAL,
estEnrollmentConfigDAL: mockEstEnrollmentConfigDAL,
acmeEnrollmentConfigDAL: mockAcmeEnrollmentConfigDAL,
+ certificateBodyDAL: mockCertificateBodyDAL,
+ certificateSecretDAL: mockCertificateSecretDAL,
+ certificateAuthorityDAL: mockCertificateAuthorityDAL,
+ certificateAuthorityCertDAL: mockCertificateAuthorityCertDAL,
permissionService: mockPermissionService,
kmsService: mockKmsService,
projectDAL: mockProjectDAL