@zeronejs/auth
Advanced tools
| export {}; |
| "use strict"; | ||
| var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
| function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
| return new (P || (P = Promise))(function (resolve, reject) { | ||
| function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
| function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
| function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
| step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
| }); | ||
| }; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| const core_1 = require("@nestjs/core"); | ||
| const jwt_1 = require("@nestjs/jwt"); | ||
| const passport_1 = require("@nestjs/passport"); | ||
| const testing_1 = require("@nestjs/testing"); | ||
| const typeorm_1 = require("@nestjs/typeorm"); | ||
| const auth_service_1 = require("../src/auth.service"); | ||
| const constants_1 = require("../src/constants"); | ||
| const userBase_entity_1 = require("../src/entities/userBase.entity"); | ||
| const jwt_auth_guard_1 = require("../src/jwt-auth.guard"); | ||
| const jwt_strategy_1 = require("../src/jwt.strategy"); | ||
| const local_strategy_1 = require("../src/local.strategy"); | ||
| describe('@zeronejs/auth', () => { | ||
| let service; | ||
| let localStrategy; | ||
| let jwtStrategy; | ||
| beforeEach(() => __awaiter(void 0, void 0, void 0, function* () { | ||
| const module = yield testing_1.Test.createTestingModule({ | ||
| imports: [ | ||
| typeorm_1.TypeOrmModule.forRoot({ | ||
| type: 'sqlite', | ||
| database: './mydb.sql', | ||
| autoLoadEntities: true, | ||
| // entities: [], | ||
| synchronize: true, | ||
| }), | ||
| passport_1.PassportModule, | ||
| jwt_1.JwtModule.register({ | ||
| secret: constants_1.jwtConstants.secret, | ||
| signOptions: { expiresIn: '6h' }, | ||
| }), | ||
| typeorm_1.TypeOrmModule.forFeature([userBase_entity_1.UserSpareEntity]), | ||
| ], | ||
| providers: [ | ||
| auth_service_1.AuthService, | ||
| local_strategy_1.LocalStrategy, | ||
| jwt_strategy_1.JwtStrategy, | ||
| { | ||
| provide: core_1.APP_GUARD, | ||
| useClass: jwt_auth_guard_1.JwtAuthGuard, | ||
| }, | ||
| ], | ||
| exports: [auth_service_1.AuthService], | ||
| }).compile(); | ||
| service = module.get(auth_service_1.AuthService); | ||
| localStrategy = module.get(local_strategy_1.LocalStrategy); | ||
| jwtStrategy = module.get(jwt_strategy_1.JwtStrategy); | ||
| })); | ||
| it('should be defined', () => { | ||
| expect(service).toBeDefined(); | ||
| expect(localStrategy).toBeDefined(); | ||
| expect(jwtStrategy).toBeDefined(); | ||
| }); | ||
| }); |
+13
| # @zeronejs/auth | ||
|  | ||
| ## Documentation | ||
| visit [zerone.top](https://zerone.top/techniques/auth.html). | ||
| ## License | ||
| [MIT](https://opensource.org/licenses/MIT) | ||
| Copyright (c) 2021-present, zeronejs |
+1
-1
| { | ||
| "name": "@zeronejs/auth", | ||
| "version": "1.0.3", | ||
| "version": "1.0.4", | ||
| "description": "", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
| "use strict"; | ||
| // import { Test, TestingModule } from '@nestjs/testing'; | ||
| // import { AuthService } from './auth.service'; | ||
| // describe('AuthService', () => { | ||
| // let service: AuthService; | ||
| // beforeEach(async () => { | ||
| // const module: TestingModule = await Test.createTestingModule({ | ||
| // providers: [AuthService], | ||
| // }).compile(); | ||
| // service = module.get<AuthService>(AuthService); | ||
| // }); | ||
| // it('should be defined', () => { | ||
| // expect(service).toBeDefined(); | ||
| // }); | ||
| // }); |
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
24172
12.61%23
4.55%494
11.26%1
-50%14
Infinity%