mirror of
https://github.com/nestjs/nest.git
synced 2026-02-21 23:11:44 +00:00
test: add microservice generic type explicitly
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { INestApplication } from '@nestjs/common';
|
||||
import { Transport } from '@nestjs/microservices';
|
||||
import { MicroserviceOptions, Transport } from '@nestjs/microservices';
|
||||
import { Test } from '@nestjs/testing';
|
||||
import * as request from 'supertest';
|
||||
import { MqttBroadcastController } from '../src/mqtt/mqtt-broadcast.controller';
|
||||
@@ -16,13 +16,13 @@ describe('MQTT transport', () => {
|
||||
app = module.createNestApplication();
|
||||
server = app.getHttpAdapter().getInstance();
|
||||
|
||||
app.connectMicroservice({
|
||||
app.connectMicroservice<MicroserviceOptions>({
|
||||
transport: Transport.MQTT,
|
||||
options: {
|
||||
host: '0.0.0.0',
|
||||
},
|
||||
});
|
||||
app.connectMicroservice({
|
||||
app.connectMicroservice<MicroserviceOptions>({
|
||||
transport: Transport.MQTT,
|
||||
options: {
|
||||
host: '0.0.0.0',
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { INestApplication } from '@nestjs/common';
|
||||
import { Transport } from '@nestjs/microservices';
|
||||
import { MicroserviceOptions, Transport } from '@nestjs/microservices';
|
||||
import { Test } from '@nestjs/testing';
|
||||
import * as request from 'supertest';
|
||||
import { NatsBroadcastController } from '../src/nats/nats-broadcast.controller';
|
||||
@@ -16,13 +16,13 @@ describe('NATS transport', () => {
|
||||
app = module.createNestApplication();
|
||||
server = app.getHttpAdapter().getInstance();
|
||||
|
||||
app.connectMicroservice({
|
||||
app.connectMicroservice<MicroserviceOptions>({
|
||||
transport: Transport.NATS,
|
||||
options: {
|
||||
servers: 'nats://0.0.0.0:4222',
|
||||
},
|
||||
});
|
||||
app.connectMicroservice({
|
||||
app.connectMicroservice<MicroserviceOptions>({
|
||||
transport: Transport.NATS,
|
||||
options: {
|
||||
servers: 'servers://0.0.0.0:4222',
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { INestApplication } from '@nestjs/common';
|
||||
import { Transport } from '@nestjs/microservices';
|
||||
import { MicroserviceOptions, Transport } from '@nestjs/microservices';
|
||||
import { Test } from '@nestjs/testing';
|
||||
import * as request from 'supertest';
|
||||
import { RedisBroadcastController } from '../src/redis/redis-broadcast.controller';
|
||||
@@ -16,16 +16,18 @@ describe('REDIS transport', () => {
|
||||
app = module.createNestApplication();
|
||||
server = app.getHttpAdapter().getInstance();
|
||||
|
||||
app.connectMicroservice({
|
||||
app.connectMicroservice<MicroserviceOptions>({
|
||||
transport: Transport.REDIS,
|
||||
options: {
|
||||
url: 'redis://0.0.0.0:6379',
|
||||
host: '0.0.0.0',
|
||||
port: 6379,
|
||||
},
|
||||
});
|
||||
app.connectMicroservice({
|
||||
app.connectMicroservice<MicroserviceOptions>({
|
||||
transport: Transport.REDIS,
|
||||
options: {
|
||||
url: 'redis://0.0.0.0:6379',
|
||||
host: '0.0.0.0',
|
||||
port: 6379,
|
||||
},
|
||||
});
|
||||
await app.startAllMicroservices();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { INestApplication, Logger } from '@nestjs/common';
|
||||
import { Transport } from '@nestjs/microservices';
|
||||
import { MicroserviceOptions, Transport } from '@nestjs/microservices';
|
||||
import { Test } from '@nestjs/testing';
|
||||
import { Admin, ITopicMetadata, Kafka } from 'kafkajs';
|
||||
import * as request from 'supertest';
|
||||
@@ -37,7 +37,7 @@ describe.skip('Kafka concurrent', function () {
|
||||
|
||||
const server = app.getHttpAdapter().getInstance();
|
||||
|
||||
app.connectMicroservice({
|
||||
app.connectMicroservice<MicroserviceOptions>({
|
||||
transport: Transport.KAFKA,
|
||||
options: {
|
||||
client: {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { INestApplication } from '@nestjs/common';
|
||||
import { Transport } from '@nestjs/microservices';
|
||||
import { MicroserviceOptions, Transport } from '@nestjs/microservices';
|
||||
import { Test } from '@nestjs/testing';
|
||||
import * as request from 'supertest';
|
||||
import { MqttController } from '../src/mqtt/mqtt.controller';
|
||||
@@ -16,7 +16,7 @@ describe('MQTT transport', () => {
|
||||
app = module.createNestApplication();
|
||||
server = app.getHttpAdapter().getInstance();
|
||||
|
||||
app.connectMicroservice({
|
||||
app.connectMicroservice<MicroserviceOptions>({
|
||||
transport: Transport.MQTT,
|
||||
options: {
|
||||
url: 'mqtt://0.0.0.0:1883',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as GRPC from '@grpc/grpc-js';
|
||||
import * as ProtoLoader from '@grpc/proto-loader';
|
||||
import { INestApplication } from '@nestjs/common';
|
||||
import { Transport } from '@nestjs/microservices';
|
||||
import { MicroserviceOptions, Transport } from '@nestjs/microservices';
|
||||
import { ExpressAdapter } from '@nestjs/platform-express';
|
||||
import { Test } from '@nestjs/testing';
|
||||
import { fail } from 'assert';
|
||||
@@ -26,7 +26,7 @@ describe('Advanced GRPC transport', () => {
|
||||
/*
|
||||
* Create microservice configuration
|
||||
*/
|
||||
app.connectMicroservice({
|
||||
app.connectMicroservice<MicroserviceOptions>({
|
||||
transport: Transport.GRPC,
|
||||
options: {
|
||||
url: 'localhost:5001',
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as GRPC from '@grpc/grpc-js';
|
||||
import * as ProtoLoader from '@grpc/proto-loader';
|
||||
import { INestApplication } from '@nestjs/common';
|
||||
import { Transport } from '@nestjs/microservices';
|
||||
import { MicroserviceOptions, Transport } from '@nestjs/microservices';
|
||||
import { Test } from '@nestjs/testing';
|
||||
import { fail } from 'assert';
|
||||
import { expect } from 'chai';
|
||||
@@ -22,7 +22,7 @@ describe('GRPC transport', () => {
|
||||
app = module.createNestApplication();
|
||||
server = app.getHttpAdapter().getInstance();
|
||||
|
||||
app.connectMicroservice({
|
||||
app.connectMicroservice<MicroserviceOptions>({
|
||||
transport: Transport.GRPC,
|
||||
options: {
|
||||
package: ['math', 'math2'],
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { INestApplication } from '@nestjs/common';
|
||||
import { Transport } from '@nestjs/microservices';
|
||||
import { MicroserviceOptions, Transport } from '@nestjs/microservices';
|
||||
import { Test } from '@nestjs/testing';
|
||||
import { expect } from 'chai';
|
||||
import * as request from 'supertest';
|
||||
@@ -29,7 +29,7 @@ describe.skip('Kafka transport', function () {
|
||||
app = module.createNestApplication();
|
||||
server = app.getHttpAdapter().getInstance();
|
||||
|
||||
app.connectMicroservice({
|
||||
app.connectMicroservice<MicroserviceOptions>({
|
||||
transport: Transport.KAFKA,
|
||||
options: {
|
||||
client: {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { INestApplication } from '@nestjs/common';
|
||||
import { Transport } from '@nestjs/microservices';
|
||||
import { MicroserviceOptions, Transport } from '@nestjs/microservices';
|
||||
import { Test } from '@nestjs/testing';
|
||||
import { expect } from 'chai';
|
||||
import * as request from 'supertest';
|
||||
@@ -17,7 +17,7 @@ describe('MQTT transport', () => {
|
||||
app = module.createNestApplication();
|
||||
server = app.getHttpAdapter().getInstance();
|
||||
|
||||
app.connectMicroservice({
|
||||
app.connectMicroservice<MicroserviceOptions>({
|
||||
transport: Transport.MQTT,
|
||||
options: {
|
||||
url: 'mqtt://0.0.0.0:1883',
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { INestApplication } from '@nestjs/common';
|
||||
import { Transport } from '@nestjs/microservices';
|
||||
import { MicroserviceOptions, Transport } from '@nestjs/microservices';
|
||||
import { Test } from '@nestjs/testing';
|
||||
import { expect } from 'chai';
|
||||
import * as request from 'supertest';
|
||||
@@ -19,7 +19,7 @@ describe('NATS transport', () => {
|
||||
app = module.createNestApplication();
|
||||
server = app.getHttpAdapter().getInstance();
|
||||
|
||||
app.connectMicroservice({
|
||||
app.connectMicroservice<MicroserviceOptions>({
|
||||
transport: Transport.NATS,
|
||||
options: {
|
||||
servers: 'nats://0.0.0.0:4222',
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { INestApplication } from '@nestjs/common';
|
||||
import { Transport } from '@nestjs/microservices';
|
||||
import { MicroserviceOptions, Transport } from '@nestjs/microservices';
|
||||
import { Test } from '@nestjs/testing';
|
||||
import { expect } from 'chai';
|
||||
import * as request from 'supertest';
|
||||
@@ -17,10 +17,11 @@ describe('REDIS transport', () => {
|
||||
app = module.createNestApplication();
|
||||
server = app.getHttpAdapter().getInstance();
|
||||
|
||||
app.connectMicroservice({
|
||||
app.connectMicroservice<MicroserviceOptions>({
|
||||
transport: Transport.REDIS,
|
||||
options: {
|
||||
url: 'redis://0.0.0.0:6379',
|
||||
host: '0.0.0.0',
|
||||
port: 6379,
|
||||
},
|
||||
});
|
||||
await app.startAllMicroservices();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { INestApplication } from '@nestjs/common';
|
||||
import { Transport } from '@nestjs/microservices';
|
||||
import { MicroserviceOptions, Transport } from '@nestjs/microservices';
|
||||
import { Test } from '@nestjs/testing';
|
||||
import { expect } from 'chai';
|
||||
import * as request from 'supertest';
|
||||
@@ -17,7 +17,7 @@ describe('RabbitMQ transport', () => {
|
||||
app = module.createNestApplication();
|
||||
server = app.getHttpAdapter().getInstance();
|
||||
|
||||
app.connectMicroservice({
|
||||
app.connectMicroservice<MicroserviceOptions>({
|
||||
transport: Transport.RMQ,
|
||||
options: {
|
||||
urls: [`amqp://0.0.0.0:5672`],
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { INestApplication } from '@nestjs/common';
|
||||
import { Transport } from '@nestjs/microservices';
|
||||
import { MicroserviceOptions, Transport } from '@nestjs/microservices';
|
||||
import { Test } from '@nestjs/testing';
|
||||
import { expect } from 'chai';
|
||||
import * as request from 'supertest';
|
||||
@@ -18,7 +18,7 @@ describe('RPC transport', () => {
|
||||
app = module.createNestApplication();
|
||||
server = app.getHttpAdapter().getInstance();
|
||||
|
||||
app.connectMicroservice({
|
||||
app.connectMicroservice<MicroserviceOptions>({
|
||||
transport: Transport.TCP,
|
||||
options: {
|
||||
host: '0.0.0.0',
|
||||
|
||||
Reference in New Issue
Block a user