mirror of
https://github.com/nestjs/nest.git
synced 2026-02-21 23:11:44 +00:00
style: fix formatting on everything
This commit is contained in:
@@ -2,6 +2,6 @@ export const mochaHooks = (): Mocha.RootHookObject => {
|
|||||||
return {
|
return {
|
||||||
async beforeAll(this: Mocha.Context) {
|
async beforeAll(this: Mocha.Context) {
|
||||||
await import('reflect-metadata');
|
await import('reflect-metadata');
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,10 +3,9 @@ import { FooService } from './foo.service';
|
|||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class BarService {
|
export class BarService {
|
||||||
|
|
||||||
constructor(private readonly foo: FooService) {}
|
constructor(private readonly foo: FooService) {}
|
||||||
|
|
||||||
bar() {
|
bar() {
|
||||||
this.foo.foo();
|
this.foo.foo();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ describe('Auto-Mocking with token in factory', () => {
|
|||||||
const moduleRef = await Test.createTestingModule({
|
const moduleRef = await Test.createTestingModule({
|
||||||
providers: [BarService],
|
providers: [BarService],
|
||||||
})
|
})
|
||||||
.useMocker((token) => {
|
.useMocker(token => {
|
||||||
if (token === FooService) {
|
if (token === FooService) {
|
||||||
return { foo: sinon.stub };
|
return { foo: sinon.stub };
|
||||||
}
|
}
|
||||||
@@ -48,16 +48,13 @@ describe('Auto-Mocking with token in factory', () => {
|
|||||||
expect(fooServ.foo.called);
|
expect(fooServ.foo.called);
|
||||||
});
|
});
|
||||||
it('cannot mock the dependencies', async () => {
|
it('cannot mock the dependencies', async () => {
|
||||||
|
|
||||||
const moduleRef = Test.createTestingModule({
|
const moduleRef = Test.createTestingModule({
|
||||||
providers: [BarService],
|
providers: [BarService],
|
||||||
})
|
}).useMocker(token => {
|
||||||
.useMocker((token) => {
|
if (token === FooService.name + 'something that fails the token') {
|
||||||
if (token === FooService.name + 'something that fails the token') {
|
return { foo: sinon.stub };
|
||||||
return { foo: sinon.stub };
|
}
|
||||||
}
|
}).compile;
|
||||||
})
|
expect(moduleRef()).to.eventually.throw();
|
||||||
.compile;
|
|
||||||
expect(moduleRef()).to.eventually.throw()
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import {
|
|||||||
Controller,
|
Controller,
|
||||||
InternalServerErrorException,
|
InternalServerErrorException,
|
||||||
Post,
|
Post,
|
||||||
RequestTimeoutException
|
RequestTimeoutException,
|
||||||
} from '@nestjs/common';
|
} from '@nestjs/common';
|
||||||
import { ClientProxyFactory } from '@nestjs/microservices';
|
import { ClientProxyFactory } from '@nestjs/microservices';
|
||||||
import { Observable, throwError } from 'rxjs';
|
import { Observable, throwError } from 'rxjs';
|
||||||
|
|||||||
@@ -1,4 +1,12 @@
|
|||||||
import { Controller, Get, Post, Body, Patch, Param, Delete } from '@nestjs/common';
|
import {
|
||||||
|
Controller,
|
||||||
|
Get,
|
||||||
|
Post,
|
||||||
|
Body,
|
||||||
|
Patch,
|
||||||
|
Param,
|
||||||
|
Delete,
|
||||||
|
} from '@nestjs/common';
|
||||||
import { UsersService } from './users.service';
|
import { UsersService } from './users.service';
|
||||||
import { CreateUserDto } from './dto/create-user.dto';
|
import { CreateUserDto } from './dto/create-user.dto';
|
||||||
import { UpdateUserDto } from './dto/update-user.dto';
|
import { UpdateUserDto } from './dto/update-user.dto';
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ export const METHOD_METADATA = 'method';
|
|||||||
export const ROUTE_ARGS_METADATA = '__routeArguments__';
|
export const ROUTE_ARGS_METADATA = '__routeArguments__';
|
||||||
export const CUSTOM_ROUTE_ARGS_METADATA = '__customRouteArgs__';
|
export const CUSTOM_ROUTE_ARGS_METADATA = '__customRouteArgs__';
|
||||||
/**
|
/**
|
||||||
* @deprecated Use `CUSTOM_ROUTE_ARGS_METADATA` instead
|
* @deprecated Use `CUSTOM_ROUTE_ARGS_METADATA` instead
|
||||||
*/
|
*/
|
||||||
export const CUSTOM_ROUTE_AGRS_METADATA = CUSTOM_ROUTE_ARGS_METADATA;
|
export const CUSTOM_ROUTE_AGRS_METADATA = CUSTOM_ROUTE_ARGS_METADATA;
|
||||||
export const EXCEPTION_FILTERS_METADATA = '__exceptionFilters__';
|
export const EXCEPTION_FILTERS_METADATA = '__exceptionFilters__';
|
||||||
export const FILTER_CATCH_EXCEPTIONS = '__filterCatchExceptions__';
|
export const FILTER_CATCH_EXCEPTIONS = '__filterCatchExceptions__';
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
export interface LazyModuleLoaderLoadOptions {
|
export interface LazyModuleLoaderLoadOptions {
|
||||||
/**
|
/**
|
||||||
* If `false`, no logs will be generated when loading some module lazily.
|
* If `false`, no logs will be generated when loading some module lazily.
|
||||||
*/
|
*/
|
||||||
logger?: boolean;
|
logger?: boolean;
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ import type { ReplFnDefinition } from '../repl.interfaces';
|
|||||||
export class MethodsReplFn extends ReplFunction {
|
export class MethodsReplFn extends ReplFunction {
|
||||||
public fnDefinition: ReplFnDefinition = {
|
public fnDefinition: ReplFnDefinition = {
|
||||||
name: 'methods',
|
name: 'methods',
|
||||||
description: 'Display all public methods available on a given provider or controller.',
|
description:
|
||||||
|
'Display all public methods available on a given provider or controller.',
|
||||||
signature: '(token: ClassRef | string) => void',
|
signature: '(token: ClassRef | string) => void',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
import { INestApplicationContext, InjectionToken, Logger } from '@nestjs/common';
|
import {
|
||||||
|
INestApplicationContext,
|
||||||
|
InjectionToken,
|
||||||
|
Logger,
|
||||||
|
} from '@nestjs/common';
|
||||||
import { ApplicationConfig } from '../application-config';
|
import { ApplicationConfig } from '../application-config';
|
||||||
import { ModuleRef, NestContainer } from '../injector';
|
import { ModuleRef, NestContainer } from '../injector';
|
||||||
import { InternalCoreModule } from '../injector/internal-core-module';
|
import { InternalCoreModule } from '../injector/internal-core-module';
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ export class KafkaContext extends BaseRpcContext<KafkaContextArgs> {
|
|||||||
/**
|
/**
|
||||||
* Returns the Kafka heartbeat callback.
|
* Returns the Kafka heartbeat callback.
|
||||||
*/
|
*/
|
||||||
getHeartbeat() {
|
getHeartbeat() {
|
||||||
return this.args[4];
|
return this.args[4];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,13 @@ import { KafkaContext } from '../../ctx-host';
|
|||||||
import { Consumer, KafkaMessage } from '../../external/kafka.interface';
|
import { Consumer, KafkaMessage } from '../../external/kafka.interface';
|
||||||
|
|
||||||
describe('KafkaContext', () => {
|
describe('KafkaContext', () => {
|
||||||
const args = ['test', { test: true }, undefined, { test: 'consumer' }, () => {}];
|
const args = [
|
||||||
|
'test',
|
||||||
|
{ test: true },
|
||||||
|
undefined,
|
||||||
|
{ test: 'consumer' },
|
||||||
|
() => {},
|
||||||
|
];
|
||||||
let context: KafkaContext;
|
let context: KafkaContext;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* -------------------------------------------------------
|
* -------------------------------------------------------
|
||||||
* THIS FILE WAS AUTOMATICALLY GENERATED (DO NOT MODIFY)
|
* THIS FILE WAS AUTOMATICALLY GENERATED (DO NOT MODIFY)
|
||||||
@@ -8,36 +7,40 @@
|
|||||||
/* tslint:disable */
|
/* tslint:disable */
|
||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
export class CreateCatInput {
|
export class CreateCatInput {
|
||||||
name?: Nullable<string>;
|
name?: Nullable<string>;
|
||||||
age?: Nullable<number>;
|
age?: Nullable<number>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export abstract class IQuery {
|
export abstract class IQuery {
|
||||||
abstract cats(): Nullable<Nullable<Cat>[]> | Promise<Nullable<Nullable<Cat>[]>>;
|
abstract cats():
|
||||||
|
| Nullable<Nullable<Cat>[]>
|
||||||
|
| Promise<Nullable<Nullable<Cat>[]>>;
|
||||||
|
|
||||||
abstract cat(id: string): Nullable<Cat> | Promise<Nullable<Cat>>;
|
abstract cat(id: string): Nullable<Cat> | Promise<Nullable<Cat>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export abstract class IMutation {
|
export abstract class IMutation {
|
||||||
abstract createCat(createCatInput?: Nullable<CreateCatInput>): Nullable<Cat> | Promise<Nullable<Cat>>;
|
abstract createCat(
|
||||||
|
createCatInput?: Nullable<CreateCatInput>,
|
||||||
|
): Nullable<Cat> | Promise<Nullable<Cat>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export abstract class ISubscription {
|
export abstract class ISubscription {
|
||||||
abstract catCreated(): Nullable<Cat> | Promise<Nullable<Cat>>;
|
abstract catCreated(): Nullable<Cat> | Promise<Nullable<Cat>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Owner {
|
export class Owner {
|
||||||
id: number;
|
id: number;
|
||||||
name: string;
|
name: string;
|
||||||
age?: Nullable<number>;
|
age?: Nullable<number>;
|
||||||
cats?: Nullable<Cat[]>;
|
cats?: Nullable<Cat[]>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Cat {
|
export class Cat {
|
||||||
id?: Nullable<number>;
|
id?: Nullable<number>;
|
||||||
name?: Nullable<string>;
|
name?: Nullable<string>;
|
||||||
age?: Nullable<number>;
|
age?: Nullable<number>;
|
||||||
owner?: Nullable<Owner>;
|
owner?: Nullable<Owner>;
|
||||||
}
|
}
|
||||||
|
|
||||||
type Nullable<T> = T | null;
|
type Nullable<T> = T | null;
|
||||||
|
|||||||
@@ -21,6 +21,6 @@ describe('AppController (e2e)', () => {
|
|||||||
.expect(200)
|
.expect(200)
|
||||||
.expect('Hello World!');
|
.expect('Hello World!');
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => app.close());
|
afterEach(() => app.close());
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user