chore: code style

This commit is contained in:
Innei
2022-04-17 21:04:37 +08:00
parent a80eb8e109
commit 4ec23b3989
126 changed files with 487 additions and 470 deletions

7
test/global.d.ts vendored
View File

@@ -1,8 +1,9 @@
import { Consola } from 'consola'
import { Document, PaginateModel } from 'mongoose'
import type { Consola } from 'consola'
import type { Document, PaginateModel } from 'mongoose'
import 'zx-cjs/globals'
import { ModelType } from '@typegoose/typegoose/lib/types'
import type { ModelType } from '@typegoose/typegoose/lib/types'
declare global {
export type KV<T = any> = Record<string, T>

View File

@@ -1,12 +1,13 @@
import { MongoMemoryServer } from 'mongodb-memory-server'
import mongoose from 'mongoose'
import { getModelForClass } from '@typegoose/typegoose'
import {
import type {
AnyParamConstructor,
BeAnObject,
IModelOptions,
ReturnModelType,
} from '@typegoose/typegoose/lib/types'
import { MongoMemoryServer } from 'mongodb-memory-server'
import mongoose from 'mongoose'
let mongod: MongoMemoryServer

View File

@@ -1,4 +1,5 @@
import IORedis, { Redis } from 'ioredis'
import type { Redis } from 'ioredis'
import IORedis from 'ioredis'
import RedisMemoryServer from 'redis-memory-server'
import { CacheService } from '~/processors/cache/cache.service'

View File

@@ -1,6 +1,7 @@
import { ValidationPipe } from '@nestjs/common'
import { NestFastifyApplication } from '@nestjs/platform-fastify'
import { TestingModule } from '@nestjs/testing'
import type { NestFastifyApplication } from '@nestjs/platform-fastify'
import type { TestingModule } from '@nestjs/testing'
import { fastifyApp } from '~/common/adapters/fastify.adapter'
export const setupE2EApp = async (module: TestingModule) => {

View File

@@ -1,4 +1,4 @@
import { NestFastifyApplication } from '@nestjs/platform-fastify'
import type { NestFastifyApplication } from '@nestjs/platform-fastify'
import { Test } from '@nestjs/testing'
import { AppController } from '~/app.controller'
@@ -6,6 +6,7 @@ import { fastifyApp } from '~/common/adapters/fastify.adapter'
import { OptionModel } from '~/modules/configs/configs.model'
import { CacheService } from '~/processors/cache/cache.service'
import { getModelToken } from '~/transformers/model.transformer'
describe('AppController (e2e)', () => {
let app: NestFastifyApplication

View File

@@ -1,14 +1,7 @@
import {
Controller,
Get,
MiddlewareConsumer,
Module,
NestModule,
Req,
UseGuards,
} from '@nestjs/common'
import type { MiddlewareConsumer, NestModule } from '@nestjs/common'
import { Controller, Get, Module, Req, UseGuards } from '@nestjs/common'
import { AuthGuard } from '@nestjs/passport'
import { NestFastifyApplication } from '@nestjs/platform-fastify'
import type { NestFastifyApplication } from '@nestjs/platform-fastify'
import { Test } from '@nestjs/testing'
import { fastifyApp } from '~/common/adapters/fastify.adapter'

View File

@@ -1,15 +1,18 @@
import { dbHelper } from 'test/helper/db-mock.helper'
import type { MockCacheService } from 'test/helper/redis-mock.helper'
import { redisHelper } from 'test/helper/redis-mock.helper'
import { BadRequestException } from '@nestjs/common'
import { EventEmitter2 } from '@nestjs/event-emitter'
import { Test } from '@nestjs/testing'
import { getModelForClass } from '@typegoose/typegoose'
import { dbHelper } from 'test/helper/db-mock.helper'
import { MockCacheService, redisHelper } from 'test/helper/redis-mock.helper'
import { getModelToken } from '~/transformers/model.transformer'
import { RedisKeys } from '~/constants/cache.constant'
import { OptionModel } from '~/modules/configs/configs.model'
import { ConfigsService } from '~/modules/configs/configs.service'
import { UserService } from '~/modules/user/user.service'
import { CacheService } from '~/processors/cache/cache.service'
import { getModelToken } from '~/transformers/model.transformer'
import { getRedisKey } from '~/utils/redis.util'
describe('Test ConfigsService', () => {

View File

@@ -1,16 +1,19 @@
import { NestFastifyApplication } from '@nestjs/platform-fastify'
import { dbHelper } from 'test/helper/db-mock.helper'
import type { MockCacheService } from 'test/helper/redis-mock.helper'
import { redisHelper } from 'test/helper/redis-mock.helper'
import { setupE2EApp } from 'test/helper/register-app.helper'
import type { NestFastifyApplication } from '@nestjs/platform-fastify'
import { Test } from '@nestjs/testing'
import { getModelForClass } from '@typegoose/typegoose'
import { dbHelper } from 'test/helper/db-mock.helper'
import { MockCacheService, redisHelper } from 'test/helper/redis-mock.helper'
import { setupE2EApp } from 'test/helper/register-app.helper'
import { getModelToken } from '~/transformers/model.transformer'
import { ServerlessService } from '~/modules/serverless/serverless.service'
import { SnippetController } from '~/modules/snippet/snippet.controller'
import { SnippetModel, SnippetType } from '~/modules/snippet/snippet.model'
import { SnippetService } from '~/modules/snippet/snippet.service'
import { CacheService } from '~/processors/cache/cache.service'
import { DatabaseService } from '~/processors/database/database.service'
import { getModelToken } from '~/transformers/model.transformer'
describe('test /snippets', () => {
let app: NestFastifyApplication

View File

@@ -1,13 +1,15 @@
import { NestFastifyApplication } from '@nestjs/platform-fastify'
import { Test } from '@nestjs/testing'
import { dbHelper } from 'test/helper/db-mock.helper'
import { redisHelper } from 'test/helper/redis-mock.helper'
import { getModelToken } from '~/transformers/model.transformer'
import type { NestFastifyApplication } from '@nestjs/platform-fastify'
import { Test } from '@nestjs/testing'
import { fastifyApp } from '~/common/adapters/fastify.adapter'
import { AuthService } from '~/modules/auth/auth.service'
import { UserController } from '~/modules/user/user.controller'
import { UserModel } from '~/modules/user/user.model'
import { UserService } from '~/modules/user/user.service'
import { getModelToken } from '~/transformers/model.transformer'
describe('AppController (e2e)', () => {
let app: NestFastifyApplication