Skip to content

Commit

Permalink
test(integration tests): rabbitmq integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
WonderPanda committed Mar 28, 2019
1 parent d4cff51 commit f624335
Show file tree
Hide file tree
Showing 29 changed files with 5,531 additions and 270 deletions.
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,17 @@ install:
- yarn travis
script:
- yarn test
- docker-compose up -d
- yarn --cwd ./integration/rabbitmq
- yarn --cwd ./examples/kitchen-sink
- yarn test:integration
cache:
yarn: true
directories:
- node_modules
services:
- docker
addons:
apt:
packages:
- docker-ce
19 changes: 19 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: "3"

services:
redis:
image: redis
ports:
- "6379:6379"

rabbit:
image: "rabbitmq:management"
environment:
RABBITMQ_ERLANG_COOKIE: "SWQOKODSQALRPCLNMEQG"
RABBITMQ_DEFAULT_USER: "rabbitmq"
RABBITMQ_DEFAULT_PASS: "rabbitmq"
RABBITMQ_DEFAULT_VHOST: "/"
ports:
- "15672:15672"
- "5672:5672"
tty: true
10 changes: 5 additions & 5 deletions examples/kitchen-sink/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@
"test:e2e": "jest --config ./test/jest-e2e.json"
},
"dependencies": {
"@nestjs-plus/rabbitmq": "^0.2.4",
"@nestjs/common": "^5.4.0",
"@nestjs/core": "^5.4.0",
"@nestjs/common": "^6.0.2",
"@nestjs/core": "^6.0.2",
"@nestjs/platform-express": "^6.0.3",
"reflect-metadata": "^0.1.12",
"rimraf": "^2.6.2",
"rxjs": "^6.2.2",
"typescript": "^3.0.1"
},
"devDependencies": {
"@nestjs/testing": "^5.1.0",
"@nestjs/testing": "^6.0.2",
"@types/express": "^4.16.0",
"@types/jest": "^23.3.1",
"@types/node": "^10.7.1",
Expand All @@ -53,7 +53,7 @@
"rootDir": "src",
"testRegex": ".spec.ts$",
"transform": {
"^.+\\.(t|j)s$": "ts-jest"
"^.+\\.ts$": "ts-jest"
},
"coverageDirectory": "../coverage",
"testEnvironment": "node"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AmqpConnection } from '@nestjs-plus/rabbitmq/lib/amqp/AmqpConnection';
import { AmqpConnection } from '@nestjs-plus/rabbitmq';
import { Controller, Get } from '@nestjs/common';

@Controller('messaging')
Expand All @@ -20,7 +20,9 @@ export class MessagingController {

@Get('/pubsub')
public async publishMessage() {
await this.amqpConnection.publish('exchange2', 'subscribe-route', { message: 42 });
await this.amqpConnection.publish('exchange2', 'subscribe-route', {
message: 42,
});
return {
result: 'Published message',
};
Expand Down
2 changes: 1 addition & 1 deletion examples/kitchen-sink/test/jest-e2e.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"testEnvironment": "node",
"testRegex": ".e2e-spec.ts$",
"transform": {
"^.+\\.(t|j)s$": "ts-jest"
"^.+\\.ts$": "ts-jest"
}
}
Loading

0 comments on commit f624335

Please sign in to comment.