mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 13:27:22 +00:00
misc: fixed tests
This commit is contained in:
@@ -9,6 +9,10 @@ import type { TPermissionServiceFactory } from "@app/ee/services/permission/perm
|
|||||||
import { ForbiddenRequestError, NotFoundError } from "@app/lib/errors";
|
import { ForbiddenRequestError, NotFoundError } from "@app/lib/errors";
|
||||||
|
|
||||||
import { ActorType, AuthMethod } from "../auth/auth-type";
|
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 type { TCertificateTemplateV2DALFactory } from "../certificate-template-v2/certificate-template-v2-dal";
|
||||||
import { TAcmeEnrollmentConfigDALFactory } from "../enrollment-config/acme-enrollment-config-dal";
|
import { TAcmeEnrollmentConfigDALFactory } from "../enrollment-config/acme-enrollment-config-dal";
|
||||||
import type { TApiEnrollmentConfigDALFactory } from "../enrollment-config/api-enrollment-config-dal";
|
import type { TApiEnrollmentConfigDALFactory } from "../enrollment-config/api-enrollment-config-dal";
|
||||||
@@ -178,6 +182,54 @@ describe("CertificateProfileService", () => {
|
|||||||
transaction: vi.fn()
|
transaction: vi.fn()
|
||||||
} as unknown as Pick<TProjectDALFactory, "findProjectBySlug" | "findOne" | "updateById" | "findById" | "transaction">;
|
} 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(() => {
|
beforeEach(() => {
|
||||||
vi.spyOn(ForbiddenError, "from").mockReturnValue({
|
vi.spyOn(ForbiddenError, "from").mockReturnValue({
|
||||||
throwUnlessCan: vi.fn()
|
throwUnlessCan: vi.fn()
|
||||||
@@ -195,6 +247,10 @@ describe("CertificateProfileService", () => {
|
|||||||
apiEnrollmentConfigDAL: mockApiEnrollmentConfigDAL,
|
apiEnrollmentConfigDAL: mockApiEnrollmentConfigDAL,
|
||||||
estEnrollmentConfigDAL: mockEstEnrollmentConfigDAL,
|
estEnrollmentConfigDAL: mockEstEnrollmentConfigDAL,
|
||||||
acmeEnrollmentConfigDAL: mockAcmeEnrollmentConfigDAL,
|
acmeEnrollmentConfigDAL: mockAcmeEnrollmentConfigDAL,
|
||||||
|
certificateBodyDAL: mockCertificateBodyDAL,
|
||||||
|
certificateSecretDAL: mockCertificateSecretDAL,
|
||||||
|
certificateAuthorityDAL: mockCertificateAuthorityDAL,
|
||||||
|
certificateAuthorityCertDAL: mockCertificateAuthorityCertDAL,
|
||||||
permissionService: mockPermissionService,
|
permissionService: mockPermissionService,
|
||||||
kmsService: mockKmsService,
|
kmsService: mockKmsService,
|
||||||
projectDAL: mockProjectDAL
|
projectDAL: mockProjectDAL
|
||||||
|
|||||||
Reference in New Issue
Block a user