@flowcore/testing-nestjs-clerk-guard
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Build

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-guard

or yarn:

yarn add @flowcore/testing-nestjs-clerk-guard @flowcore/nestjs-clerk-guard

Usage

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 install

or with npm:

npm install

Readme

Keywords

Package Sidebar

Install

npm i @flowcore/testing-nestjs-clerk-guard

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

212 kB

Total Files

16

Last publish

Collaborators

  • jbiskur