Files
calendar/apps/api/v2/test/utils/withApiAuth.ts
T
MorganandGitHub 9a473d5b55 chore: auth on api-v2 with api-key (#15455)
* chore: enable apiv2 auth with api keys

* chore: enable apiv2 auth with api keys

* chore: enable apiv2 auth with api keys

* chore: enable apiv2 auth with api keys

* chore: enable apiv2 auth with api keys

* fixup! chore: enable apiv2 auth with api keys

* fixup! Merge branch 'chore-apiv2-auth-api-key' of github.com:calcom/cal.com into chore-apiv2-auth-api-key

* fixup! fixup! Merge branch 'chore-apiv2-auth-api-key' of github.com:calcom/cal.com into chore-apiv2-auth-api-key

* fixup! fixup! fixup! Merge branch 'chore-apiv2-auth-api-key' of github.com:calcom/cal.com into chore-apiv2-auth-api-key
2024-06-19 16:00:22 +00:00

11 lines
555 B
TypeScript

import { ApiAuthStrategy } from "@/modules/auth/strategies/api-auth/api-auth.strategy";
import { UsersRepository } from "@/modules/users/users.repository";
import { TestingModuleBuilder } from "@nestjs/testing";
import { ApiAuthMockStrategy } from "test/mocks/api-auth-mock.strategy";
export const withApiAuth = (email: string, module: TestingModuleBuilder) =>
module.overrideProvider(ApiAuthStrategy).useFactory({
factory: (usersRepository: UsersRepository) => new ApiAuthMockStrategy(email, usersRepository),
inject: [UsersRepository],
});