mirror of
https://github.com/nestjs/nest.git
synced 2026-02-21 23:11:44 +00:00
ci() add npm install before integration tests and sampels ci() add machine option to integraiton tests ci() setup remote docker for integration tests ci() add unit tests mixin function ci() add unit tests mixin function ci() fix working directory for integration tests ci() rename unit tests function ci() use reusable run-unit-tests config ci() update naming, add coveralls ci() add alias for unit tests ci() add aliases (circleci) ci() remove run command from aliases ci() fix aliases ci(): fix restore cache alias ci() add list containers step to integration tests integration() bind urls and hosts to 0.0.0.0 ci() add waiting for mysql task ci() hotfix, move tasks order (integration) ci() wait for mysql - change hostname, increase sleep time ci() add sleep after docker-compose up (integration) ci() add sleep after docker-compose up fix (seconds) ci() switch to machine mode (integration tests) ci() use nvm to switch default node version ci() hotfix, wrong indentation (integration tests) ci() add ls-remove (nvm) and node version check ci() fix install npm task ci() wip use nvm to run integration tests ci() remove NPM upgrade task
45 lines
1.1 KiB
TypeScript
45 lines
1.1 KiB
TypeScript
import { INestApplication } from '@nestjs/common';
|
|
import { Transport } from '@nestjs/microservices';
|
|
import { Test } from '@nestjs/testing';
|
|
import * as request from 'supertest';
|
|
import { NatsBroadcastController } from '../src/nats/nats-broadcast.controller';
|
|
|
|
describe('NATS transport', () => {
|
|
let server;
|
|
let app: INestApplication;
|
|
|
|
beforeEach(async () => {
|
|
const module = await Test.createTestingModule({
|
|
controllers: [NatsBroadcastController],
|
|
}).compile();
|
|
|
|
app = module.createNestApplication();
|
|
server = app.getHttpAdapter().getInstance();
|
|
|
|
app.connectMicroservice({
|
|
transport: Transport.NATS,
|
|
options: {
|
|
url: 'nats://0.0.0.0:4222',
|
|
},
|
|
});
|
|
app.connectMicroservice({
|
|
transport: Transport.NATS,
|
|
options: {
|
|
url: 'nats://0.0.0.0:4222',
|
|
},
|
|
});
|
|
await app.startAllMicroservicesAsync();
|
|
await app.init();
|
|
});
|
|
|
|
it(`Broadcast (2 subscribers)`, () => {
|
|
return request(server)
|
|
.get('/broadcast')
|
|
.expect(200, '2');
|
|
});
|
|
|
|
afterEach(async () => {
|
|
await app.close();
|
|
});
|
|
});
|