Skip to content

Commit

Permalink
#1 - Create tests (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
LukaszLupa authored May 11, 2022
1 parent 93dbca3 commit d6bd731
Show file tree
Hide file tree
Showing 14 changed files with 7,463 additions and 741 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: "Test package"

on:
pull_request:
branches: [master]

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v3
- name: "Use Node.js"
uses: actions/setup-node@v3
with:
node-version: 14
cache: "npm"
- name: "Install npm"
run: npm ci
- name: "Run all tests"
run: npm run test
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# NestJS Auth0

[![Test package](https://github.com/Twirelab/nestjs-auth0/actions/workflows/tests.yml/badge.svg)](https://github.com/Twirelab/nestjs-auth0/actions/workflows/tests.yml)

NodeJS Auth0 wrapper for Nestjs

## Install
Expand Down Expand Up @@ -39,11 +41,11 @@ export class AppModule {}
Add below code into app.module.js file.

```typescript
import { AuthenticationModule } from "@twirelab/nestjs-auth0";
import { ManagementModule } from "@twirelab/nestjs-auth0";

@Module({
imports: [
AuthenticationModule.forRoot({
ManagementModule.forRoot({
token: '{YOUR_API_V2_TOKEN}',
domain: '{YOUR_ACCOUNT}.auth0.com',
}),
Expand All @@ -55,11 +57,11 @@ export class AppModule {}
To obtain **automatically** a Management API token via the ManagementClient, you can specify the parameters `clientId`, `clientSecret` (use a Non Interactive Client) and optionally `scope`. Behind the scenes the Client Credentials Grant is used to obtain the `access_token` and is by default cached for the duration of the returned `expires_in` value.

```typescript
import { AuthenticationModule } from "@twirelab/nestjs-auth0";
import { ManagementModule } from "@twirelab/nestjs-auth0";

@Module({
imports: [
AuthenticationModule.forRoot({
ManagementModule.forRoot({
domain: '{YOUR_ACCOUNT}.auth0.com',
clientId: '{YOUR_NON_INTERACTIVE_CLIENT_ID}',
clientSecret: '{YOUR_NON_INTERACTIVE_CLIENT_SECRET}',
Expand Down
4 changes: 4 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
preset: "ts-jest",
testEnvironment: "node"
}
Loading

0 comments on commit d6bd731

Please sign in to comment.