Skip to content

Commit 3b69819

Browse files
format(@nestjs) run prettier, format existing codebase
1 parent 84f531c commit 3b69819

8 files changed

Lines changed: 34 additions & 33 deletions

File tree

integration/microservices/e2e/multicast-mqtt.spec.ts renamed to integration/microservices/e2e/broadcast-mqtt.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ import * as request from 'supertest';
33
import { Test } from '@nestjs/testing';
44
import { INestApplication } from '@nestjs/common';
55
import { Transport } from '@nestjs/microservices';
6-
import { MqttMulticastController } from '../src/mqtt/mqtt-multicast.controller';
6+
import { MqttBroadcastController } from '../src/mqtt/mqtt-broadcast.controller';
77

88
describe('MQTT transport', () => {
99
let server;
1010
let app: INestApplication;
1111

1212
beforeEach(async () => {
1313
const module = await Test.createTestingModule({
14-
controllers: [MqttMulticastController],
14+
controllers: [MqttBroadcastController],
1515
}).compile();
1616

1717
server = express();
@@ -26,9 +26,9 @@ describe('MQTT transport', () => {
2626
await app.init();
2727
});
2828

29-
it(`Multicast (2 subscribers)`, () => {
29+
it(`Broadcast (2 subscribers)`, () => {
3030
return request(server)
31-
.get('/multicast')
31+
.get('/broadcast')
3232
.expect(200, '2');
3333
});
3434

integration/microservices/e2e/multicast-nats.spec.ts renamed to integration/microservices/e2e/broadcast-nats.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ import * as request from 'supertest';
33
import { Test } from '@nestjs/testing';
44
import { INestApplication } from '@nestjs/common';
55
import { Transport } from '@nestjs/microservices';
6-
import { NatsMulticastController } from '../src/nats/nats-multicast.controller';
6+
import { NatsBroadcastController } from '../src/nats/nats-broadcast.controller';
77

88
describe('NATS transport', () => {
99
let server;
1010
let app: INestApplication;
1111

1212
beforeEach(async () => {
1313
const module = await Test.createTestingModule({
14-
controllers: [NatsMulticastController],
14+
controllers: [NatsBroadcastController],
1515
}).compile();
1616

1717
server = express();
@@ -27,9 +27,9 @@ describe('NATS transport', () => {
2727
await app.init();
2828
});
2929

30-
it(`Multicast (2 subscribers)`, () => {
30+
it(`Broadcast (2 subscribers)`, () => {
3131
return request(server)
32-
.get('/multicast')
32+
.get('/broadcast')
3333
.expect(200, '2');
3434
});
3535

integration/microservices/e2e/multicast-redis.spec.ts renamed to integration/microservices/e2e/broadcast-redis.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ import { Test } from '@nestjs/testing';
44
import { INestApplication } from '@nestjs/common';
55
import { Transport } from '@nestjs/microservices';
66
import { RedisController } from '../src/redis/redis.controller';
7-
import { RedisMulticastController } from '../src/redis/redis-multicast.controller';
7+
import { RedisBroadcastController } from '../src/redis/redis-broadcast.controller';
88

99
describe('REDIS transport', () => {
1010
let server;
1111
let app: INestApplication;
1212

1313
beforeEach(async () => {
1414
const module = await Test.createTestingModule({
15-
controllers: [RedisMulticastController],
15+
controllers: [RedisBroadcastController],
1616
}).compile();
1717

1818
server = express();
@@ -27,9 +27,9 @@ describe('REDIS transport', () => {
2727
await app.init();
2828
});
2929

30-
it(`Multicast (2 subscribers)`, () => {
30+
it(`Broadcast (2 subscribers)`, () => {
3131
return request(server)
32-
.get('/multicast')
32+
.get('/broadcast')
3333
.expect(200, '2');
3434
});
3535

integration/microservices/src/mqtt/mqtt-multicast.controller.ts renamed to integration/microservices/src/mqtt/mqtt-broadcast.controller.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@ import { Observable } from 'rxjs/Observable';
99
import { scan, take } from 'rxjs/operators';
1010

1111
@Controller()
12-
export class MqttMulticastController {
12+
export class MqttBroadcastController {
1313
@Client({ transport: Transport.MQTT })
1414
client: ClientProxy;
1515

16-
@Get('multicast')
16+
@Get('broadcast')
1717
multicats() {
1818
return this.client
19-
.send<number>({ cmd: 'multicast' }, {})
19+
.send<number>({ cmd: 'broadcast' }, {})
2020
.pipe(scan((a, b) => a + b), take(2));
2121
}
2222

23-
@MessagePattern({ cmd: 'multicast' })
24-
replyMulticast(): Observable<number> {
23+
@MessagePattern({ cmd: 'broadcast' })
24+
replyBroadcast(): Observable<number> {
2525
return new Observable(observer => observer.next(1));
2626
}
2727
}

integration/microservices/src/nats/nats-multicast.controller.ts renamed to integration/microservices/src/nats/nats-broadcast.controller.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@ import { Observable } from 'rxjs/Observable';
99
import { scan, take } from 'rxjs/operators';
1010

1111
@Controller()
12-
export class NatsMulticastController {
12+
export class NatsBroadcastController {
1313
@Client({ transport: Transport.NATS })
1414
client: ClientProxy;
1515

16-
@Get('multicast')
16+
@Get('broadcast')
1717
multicats() {
1818
return this.client
19-
.send<number>({ cmd: 'multicast' }, {})
19+
.send<number>({ cmd: 'broadcast' }, {})
2020
.pipe(scan((a, b) => a + b), take(2));
2121
}
2222

23-
@MessagePattern({ cmd: 'multicast' })
24-
replyMulticast(): Observable<number> {
23+
@MessagePattern({ cmd: 'broadcast' })
24+
replyBroadcast(): Observable<number> {
2525
return new Observable(observer => observer.next(1));
2626
}
2727
}

integration/microservices/src/redis/redis-multicast.controller.ts renamed to integration/microservices/src/redis/redis-broadcast.controller.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,21 @@ import { Observable } from 'rxjs/Observable';
99
import { scan, take } from 'rxjs/operators';
1010

1111
@Controller()
12-
export class RedisMulticastController {
12+
export class RedisBroadcastController {
1313
@Client({ transport: Transport.REDIS })
1414
client: ClientProxy;
1515

16-
@Get('multicast')
16+
@Get('broadcast')
1717
multicats() {
18-
return this.client.send<number>({ cmd: 'multicast' }, {})
18+
return this.client.send<number>({ cmd: 'broadcast' }, {})
1919
.pipe(
2020
scan((a, b) => a + b),
2121
take(2),
2222
);
2323
}
2424

25-
@MessagePattern({ cmd: 'multicast' })
26-
replyMulticast(): Observable<number> {
25+
@MessagePattern({ cmd: 'broadcast' })
26+
replyBroadcast(): Observable<number> {
2727
return new Observable((observer) => observer.next(1));
2828
}
2929
}

src/core/scanner.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,11 @@ export class DependenciesScanner {
6666
});
6767
}
6868

69-
public reflectRelatedModules(module: Type<any>, token: string, context: string) {
69+
public reflectRelatedModules(
70+
module: Type<any>,
71+
token: string,
72+
context: string,
73+
) {
7074
const modules = [
7175
...this.reflectMetadata(module, metadata.MODULES),
7276
...this.container.getDynamicMetadataByToken(

src/websockets/web-sockets-controller.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@ import {
99
} from './gateway-metadata-explorer';
1010
import { Subject } from 'rxjs/Subject';
1111
import { SocketServerProvider } from './socket-server-provider';
12-
import {
13-
PORT_METADATA,
14-
GATEWAY_OPTIONS,
15-
} from './constants';
12+
import { PORT_METADATA, GATEWAY_OPTIONS } from './constants';
1613
import { Type } from '@nestjs/common/interfaces/type.interface';
1714
import { MetadataScanner } from '@nestjs/core/metadata-scanner';
1815
import { NestContainer } from '@nestjs/core/injector/container';
@@ -47,7 +44,7 @@ export class WebSocketsController {
4744
) {
4845
const options = Reflect.getMetadata(GATEWAY_OPTIONS, metatype) || {};
4946
const port = Reflect.getMetadata(PORT_METADATA, metatype) || 0;
50-
47+
5148
if (!Number.isInteger(port)) {
5249
throw new InvalidSocketPortException(port, metatype);
5350
}

0 commit comments

Comments
 (0)