1.0.0 • Published 2 years ago
@flowcore/testing-nestjs-clerk-guard v1.0.0
Testing NestJS Clerk Guard
A NestJS ClerkGuard plugin for the @jbiskur/nestjs-test-utilities testing library. To facilitate mocking successful calls to protected routes during testing.
Installation
install with npm:
npm install @flowcore/testing-nestjs-clerk-guard @flowcore/nestjs-clerk-guardor yarn:
yarn add @flowcore/testing-nestjs-clerk-guard @flowcore/nestjs-clerk-guardUsage
To use the library with the @jbiskur/nestjs-test-utilities testing library, you need to invoke it using with:
import {ClerkGuardModulePlugin} from '@flowcore/testing-nestjs-clerk-guard';
app = await new NestApplicationBuilder()
.withTestModule((testModule) => testModule.withModule(TestModule))
// ... other plugins
.with(ClerkGuardModulePlugin)
// ... other plugins
.build();It is possible to set the authenticated payload that will be returned by the AuthGuard:
import {ClerkGuardModulePlugin} from '@flowcore/testing-nestjs-clerk-guard';
app = await new NestApplicationBuilder()
.withTestModule((testModule) => testModule.withModule(TestModule))
// ... other plugins
.with(ClerkGuardModulePlugin, pluginBuilder => pluginBuilder.usingAuthenticatedPayload(validTokenPayload))
.build();Development
yarn installor with npm:
npm install1.0.0
2 years ago