Skip to content

Commit bc707b2

Browse files
author
kamil.mysliwiec
committed
Name typo fix
1 parent 285528d commit bc707b2

10 files changed

Lines changed: 23 additions & 22 deletions

File tree

src/core/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export const messages = {
22
APPLICATION_START: `Starting Nest application...`,
33
APPLICATION_READY: `Nest application is ready!`,
4-
UNKOWN_EXCEPTION_MESSAGE: 'Unkown exception',
4+
UNKNOWN_EXCEPTION_MESSAGE: 'Unkown exception',
55
};

src/core/exceptions/exceptions-handler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export class ExceptionsHandler {
1313
if (this.invokeCustomFilters(exception, response)) return;
1414

1515
if (!(exception instanceof HttpException)) {
16-
response.status(500).json({ message: messages.UNKOWN_EXCEPTION_MESSAGE });
16+
response.status(500).json({ message: messages.UNKNOWN_EXCEPTION_MESSAGE });
1717

1818
this.logger.error(exception.message, exception.stack);
1919
return;

src/core/injector/container.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Controller, Injectable } from '../../common/interfaces/';
22
import { Module } from './module';
3-
import { UnkownModuleException } from '../../errors/exceptions/unkown-module.exception';
3+
import { UnknownModuleException } from '../../errors/exceptions/unknown-module.exception';
44
import { NestModuleMetatype } from '../../common/interfaces/module-metatype.interface';
55
import { Metatype } from '../../common/interfaces/metatype.interface';
66

@@ -28,23 +28,23 @@ export class NestContainer {
2828

2929
public addComponent(component: Metatype<Injectable>, metatype: NestModuleMetatype) {
3030
if (!this.modules.has(metatype.name)) {
31-
throw new UnkownModuleException();
31+
throw new UnknownModuleException();
3232
}
3333
const module = this.modules.get(metatype.name);
3434
module.addComponent(component);
3535
}
3636

3737
public addExportedComponent(exportedComponent: Metatype<Injectable>, metatype: NestModuleMetatype) {
3838
if (!this.modules.has(metatype.name)) {
39-
throw new UnkownModuleException();
39+
throw new UnknownModuleException();
4040
}
4141
const module = this.modules.get(metatype.name);
4242
module.addExportedComponent(exportedComponent);
4343
}
4444

4545
public addController(controller: Metatype<Controller>, metatype: NestModuleMetatype) {
4646
if (!this.modules.has(metatype.name)) {
47-
throw new UnkownModuleException();
47+
throw new UnknownModuleException();
4848
}
4949
const module = this.modules.get(metatype.name);
5050
module.addRoute(controller);

src/core/router/router-exception-filters.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { isEmpty, isFunction } from '../../common/utils/shared.utils';
66
import { Metatype } from '../../common/interfaces/index';
77
import { ExceptionFilterMetadata } from '../../common/interfaces/exception-filter-metadata.interface';
88
import { NestContainer } from '../injector/container';
9-
import { UnkownModuleException } from '../../errors/exceptions/unkown-module.exception';
9+
import { UnknownModuleException } from '../../errors/exceptions/unknown-module.exception';
1010
import { ExceptionFilter } from '../../common/interfaces/exception-filter.interface';
1111

1212
export class RouterExceptionFilters {
@@ -45,7 +45,7 @@ export class RouterExceptionFilters {
4545
public findExceptionsFilterInstance(metatype: Metatype<any>, moduleName: string): ExceptionFilter {
4646
const modules = this.container.getModules();
4747
if (!modules.has(moduleName)) {
48-
throw new UnkownModuleException();
48+
throw new UnknownModuleException();
4949
}
5050
const { components } = modules.get(moduleName);
5151
const { instance } = components.get(metatype.name);

src/core/scanner.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export class DependenciesScanner {
1919
this.storeModule(module);
2020

2121
const importedModules = this.reflectMetadata(module, metadata.MODULES);
22-
importedModules.map((imported) => this.scanForModules(imported));
22+
importedModules.map((innerModule) => this.scanForModules(innerModule));
2323
}
2424

2525
private storeModule(module: NestModuleMetatype) {

src/core/test/injector/container.spec.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { expect } from 'chai';
22
import * as sinon from 'sinon';
33
import { NestContainer } from '../../injector/container';
44
import { Module } from '../../../common/utils/decorators/module.decorator';
5-
import { UnkownModuleException } from '../../../errors/exceptions/unkown-module.exception';
5+
import { UnknownModuleException } from '../../../errors/exceptions/unknown-module.exception';
66

77
describe('NestContainer', () => {
88
let container: NestContainer;
@@ -25,16 +25,16 @@ describe('NestContainer', () => {
2525
expect(setSpy.calledOnce).to.be.true;
2626
});
2727

28-
it('should "addComponent" throw "UnkownModuleException" when module is not stored in collection', () => {
29-
expect(() => container.addComponent(null, TestModule)).throw(UnkownModuleException);
28+
it('should "addComponent" throw "UnknownModuleException" when module is not stored in collection', () => {
29+
expect(() => container.addComponent(null, TestModule)).throw(UnknownModuleException);
3030
});
3131

32-
it('should "addController" throw "UnkownModuleException" when module is not stored in collection', () => {
33-
expect(() => container.addController(null, TestModule)).throw(UnkownModuleException);
32+
it('should "addController" throw "UnknownModuleException" when module is not stored in collection', () => {
33+
expect(() => container.addController(null, TestModule)).throw(UnknownModuleException);
3434
});
3535

36-
it('should "addExportedComponent" throw "UnkownModuleException" when module is not stored in collection', () => {
37-
expect(() => container.addExportedComponent(null, TestModule)).throw(UnkownModuleException);
36+
it('should "addExportedComponent" throw "UnknownModuleException" when module is not stored in collection', () => {
37+
expect(() => container.addExportedComponent(null, TestModule)).throw(UnknownModuleException);
3838
});
3939

4040
});

src/errors/exceptions/unkown-module.exception.ts renamed to src/errors/exceptions/unknown-module.exception.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { RuntimeException } from './runtime.exception';
22

3-
export class UnkownModuleException extends RuntimeException {
3+
export class UnknownModuleException extends RuntimeException {
44
constructor() {
55
super();
66
}

src/nest-application.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export class NestApplication implements INestApplication {
2727
}
2828

2929
public listen(port: number, callback?: () => void) {
30+
console.log(this.container.getModules());
3031
this.setupMiddlewares(this.express);
3132
this.setupRoutes(this.express);
3233

src/websockets/middlewares-injector.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import 'reflect-metadata';
22
import { NestContainer, InstanceWrapper } from '../core/injector/container';
33
import { NestGateway } from './index';
44
import { GATEWAY_MIDDLEWARES } from './constants';
5-
import { UnkownModuleException } from '../errors/exceptions/unkown-module.exception';
5+
import { UnknownModuleException } from '../errors/exceptions/unknown-module.exception';
66
import { Injectable } from '../common/interfaces/injectable.interface';
77
import { RuntimeException } from '../errors/exceptions/runtime.exception';
88
import { GatewayMiddleware } from './interfaces/gateway-middleware.interface';
@@ -15,7 +15,7 @@ export class MiddlewaresInjector {
1515
const opaqueTokens = this.reflectMiddlewaresTokens(instance);
1616
const modules = this.container.getModules();
1717
if (!modules.has(module)) {
18-
throw new UnkownModuleException();
18+
throw new UnknownModuleException();
1919
}
2020
const { components } = modules.get(module);
2121
this.applyMiddlewares(server, components, opaqueTokens);

src/websockets/test/middlewares-injector.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as sinon from 'sinon';
22
import { expect } from 'chai';
33
import { MiddlewaresInjector } from '../middlewares-injector';
4-
import { UnkownModuleException } from '../../errors/exceptions/unkown-module.exception';
4+
import { UnknownModuleException } from '../../errors/exceptions/unknown-module.exception';
55
import { WebSocketGateway } from '../index';
66
import { RuntimeException } from '../../errors/exceptions/runtime.exception';
77

@@ -23,11 +23,11 @@ describe('MiddlewaresInjector', () => {
2323
beforeEach(() => {
2424
sinon.stub(injector, 'reflectMiddlewaresTokens').returns(tokens);
2525
});
26-
it('should throws "UnkownModuleException" when module is not known', () => {
26+
it('should throws "UnknownModuleException" when module is not known', () => {
2727
sinon.stub(modules, 'has').returns(false);
2828
expect(
2929
() => injector.inject(null, null, ''),
30-
).to.throws(UnkownModuleException);
30+
).to.throws(UnknownModuleException);
3131
});
3232
it('should call "applyMiddlewares" with expected arguments', () => {
3333
const components = {};

0 commit comments

Comments
 (0)