Skip to content

Commit

Permalink
Added envs for testing env
Browse files Browse the repository at this point in the history
  • Loading branch information
ashleigh authored and bashleigh committed Sep 10, 2018
1 parent cbe2428 commit d53ff56
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 10 deletions.
1 change: 1 addition & 0 deletions .env.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
HOST=localhost
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"@types/es6-promise": "^3.3.0",
"@types/node": "^10.5.1",
"coveralls": "^3.0.2",
"dotenv": "^6.0.0",
"jest": "^23.4.0",
"nestjs-config": "^1.2.3",
"prettier": "^1.13.7",
Expand Down Expand Up @@ -53,6 +54,7 @@
"transform": {
"^.+\\.(t|j)s$": "ts-jest"
},
"coverageDirectory": "./coverage"
"coverageDirectory": "./coverage",
"setupFiles": ["<rootDir>/__tests__/setup.js"]
}
}
6 changes: 3 additions & 3 deletions src/__tests__/amqp.inject.decorator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('InjectAmqpConnection', () => {
const module: TestingModule = await Test.createTestingModule({
imports: [
AmqpModule.forRoot({
host: 'localhost',
host: process.env.HOST,
}),
],
providers: [TestProvider],
Expand All @@ -43,10 +43,10 @@ describe('InjectAmqpConnection', () => {
imports: [
AmqpModule.forRoot([
{
host: 'localhost',
host: process.env.HOST,
},
{
host: 'localhost',
host: process.env.HOST,
},
]),
],
Expand Down
12 changes: 6 additions & 6 deletions src/__tests__/amqp.module.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe('AmqpModule', () => {
const module: TestingModule = await Test.createTestingModule({
imports: [
AmqpModule.forRoot({
host: 'amqp://localhost:5672',
host: `amqp://${process.env.HOST}:5672`,
}),
],
}).compile();
Expand All @@ -25,7 +25,7 @@ describe('AmqpModule', () => {
const module: TestingModule = await Test.createTestingModule({
imports: [
AmqpModule.forRoot({
host: 'amqp://localhost:5672',
host: `amqp://${process.env.HOST}:5672`,
}),
],
}).compile();
Expand All @@ -42,11 +42,11 @@ describe('AmqpModule', () => {
imports: [
AmqpModule.forRoot([
{
host: 'amqp://localhost:5672',
host: `amqp://${process.env.HOST}:5672`,
name: 'test',
},
{
host: 'amqp://localhost:5672',
host: `amqp://${process.env.HOST}:5672`,
},
]),
],
Expand All @@ -66,7 +66,7 @@ describe('AmqpModule', () => {
const module: TestingModule = await Test.createTestingModule({
imports: [
AmqpModule.forRoot({
host: 'localhost',
host: process.env.HOST,
name: 'test',
port: 5673,
username: 'user',
Expand All @@ -91,7 +91,7 @@ describe('AmqpModule', () => {
const module: TestingModule = await Test.createTestingModule({
imports: [
AmqpModule.forRoot({
host: 'localhost',
host: process.env.HOST,
}),
SubModule,
],
Expand Down
6 changes: 6 additions & 0 deletions src/__tests__/setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
var dotenv = require('dotenv');
var path = require('path');

dotenv.config({
path: path.resolve(__dirname, '..', '..', '.env'),
});

0 comments on commit d53ff56

Please sign in to comment.