Skip to content

Commit

Permalink
Merge pull request #10153 from micalevisk/style/fix-formatting
Browse files Browse the repository at this point in the history
style: fix formatting
  • Loading branch information
kamilmysliwiec committed Aug 23, 2022
2 parents 6b43e37 + bc80ef6 commit 09dcb61
Show file tree
Hide file tree
Showing 13 changed files with 57 additions and 39 deletions.
2 changes: 1 addition & 1 deletion hooks/mocha-init-hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ export const mochaHooks = (): Mocha.RootHookObject => {
return {
async beforeAll(this: Mocha.Context) {
await import('reflect-metadata');
}
},
};
};
3 changes: 1 addition & 2 deletions integration/auto-mock/src/bar.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ import { FooService } from './foo.service';

@Injectable()
export class BarService {

constructor(private readonly foo: FooService) {}

bar() {
this.foo.foo();
}
}
}
17 changes: 7 additions & 10 deletions integration/auto-mock/test/bar.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('Auto-Mocking with token in factory', () => {
const moduleRef = await Test.createTestingModule({
providers: [BarService],
})
.useMocker((token) => {
.useMocker(token => {
if (token === FooService) {
return { foo: sinon.stub };
}
Expand All @@ -48,16 +48,13 @@ describe('Auto-Mocking with token in factory', () => {
expect(fooServ.foo.called);
});
it('cannot mock the dependencies', async () => {

const moduleRef = Test.createTestingModule({
providers: [BarService],
})
.useMocker((token) => {
if (token === FooService.name + 'something that fails the token') {
return { foo: sinon.stub };
}
})
.compile;
expect(moduleRef()).to.eventually.throw()
}).useMocker(token => {
if (token === FooService.name + 'something that fails the token') {
return { foo: sinon.stub };
}
}).compile;
expect(moduleRef()).to.eventually.throw();
});
});
2 changes: 1 addition & 1 deletion integration/microservices/src/disconnected.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
Controller,
InternalServerErrorException,
Post,
RequestTimeoutException
RequestTimeoutException,
} from '@nestjs/common';
import { ClientProxyFactory } from '@nestjs/microservices';
import { Observable, throwError } from 'rxjs';
Expand Down
10 changes: 9 additions & 1 deletion integration/repl/src/users/users.controller.ts
Original file line number Diff line number Diff line change
@@ -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 { CreateUserDto } from './dto/create-user.dto';
import { UpdateUserDto } from './dto/update-user.dto';
Expand Down
4 changes: 2 additions & 2 deletions packages/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ export const METHOD_METADATA = 'method';
export const ROUTE_ARGS_METADATA = '__routeArguments__';
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 EXCEPTION_FILTERS_METADATA = '__exceptionFilters__';
export const FILTER_CATCH_EXCEPTIONS = '__filterCatchExceptions__';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export interface LazyModuleLoaderLoadOptions {
/**
/**
* If `false`, no logs will be generated when loading some module lazily.
*/
logger?: boolean;
Expand Down
3 changes: 2 additions & 1 deletion packages/core/repl/native-functions/methods-repl-fn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import type { ReplFnDefinition } from '../repl.interfaces';
export class MethodsReplFn extends ReplFunction {
public fnDefinition: ReplFnDefinition = {
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',
};

Expand Down
6 changes: 5 additions & 1 deletion packages/core/repl/repl-context.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { INestApplicationContext, InjectionToken, Logger } from '@nestjs/common';
import {
INestApplicationContext,
InjectionToken,
Logger,
} from '@nestjs/common';
import { ApplicationConfig } from '../application-config';
import { ModuleRef, NestContainer } from '../injector';
import { InternalCoreModule } from '../injector/internal-core-module';
Expand Down
4 changes: 2 additions & 2 deletions packages/microservices/ctx-host/kafka.context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class KafkaContext extends BaseRpcContext<KafkaContextArgs> {
/**
* Returns the Kafka heartbeat callback.
*/
getHeartbeat() {
getHeartbeat() {
return this.args[4];
}
}
}
8 changes: 7 additions & 1 deletion packages/microservices/test/ctx-host/kafka.context.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ import { KafkaContext } from '../../ctx-host';
import { Consumer, KafkaMessage } from '../../external/kafka.interface';

describe('KafkaContext', () => {
const args = ['test', { test: true }, undefined, { test: 'consumer' }, () => {}];
const args = [
'test',
{ test: true },
undefined,
{ test: 'consumer' },
() => {},
];
let context: KafkaContext;

beforeEach(() => {
Expand Down
33 changes: 18 additions & 15 deletions sample/12-graphql-schema-first/src/graphql.schema.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
* -------------------------------------------------------
* THIS FILE WAS AUTOMATICALLY GENERATED (DO NOT MODIFY)
Expand All @@ -8,36 +7,40 @@
/* tslint:disable */
/* eslint-disable */
export class CreateCatInput {
name?: Nullable<string>;
age?: Nullable<number>;
name?: Nullable<string>;
age?: Nullable<number>;
}

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 {
abstract createCat(createCatInput?: Nullable<CreateCatInput>): Nullable<Cat> | Promise<Nullable<Cat>>;
abstract createCat(
createCatInput?: Nullable<CreateCatInput>,
): Nullable<Cat> | Promise<Nullable<Cat>>;
}

export abstract class ISubscription {
abstract catCreated(): Nullable<Cat> | Promise<Nullable<Cat>>;
abstract catCreated(): Nullable<Cat> | Promise<Nullable<Cat>>;
}

export class Owner {
id: number;
name: string;
age?: Nullable<number>;
cats?: Nullable<Cat[]>;
id: number;
name: string;
age?: Nullable<number>;
cats?: Nullable<Cat[]>;
}

export class Cat {
id?: Nullable<number>;
name?: Nullable<string>;
age?: Nullable<number>;
owner?: Nullable<Owner>;
id?: Nullable<number>;
name?: Nullable<string>;
age?: Nullable<number>;
owner?: Nullable<Owner>;
}

type Nullable<T> = T | null;
2 changes: 1 addition & 1 deletion sample/30-event-emitter/test/app.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ describe('AppController (e2e)', () => {
.expect(200)
.expect('Hello World!');
});

afterEach(() => app.close());
});

0 comments on commit 09dcb61

Please sign in to comment.