Skip to content

Commit

Permalink
fix docker test
Browse files Browse the repository at this point in the history
  • Loading branch information
aradwann committed Mar 6, 2023
1 parent 2a7710a commit 7e828e5
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 14 deletions.
5 changes: 4 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@ Dockerfile
.dockerignore
node_modules
npm-debug.log
dist
dist
.git
.env
docker.env
2 changes: 1 addition & 1 deletion .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ POSTGRES_PASSWORD=password
POSTGRES_DB=uptime

############## REDIS ###########
REDIS_HOST=redis
REDIS_HOST=localhost
REDIS_PORT=6380
10 changes: 9 additions & 1 deletion docker-compose.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,15 @@ services:
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
ports:
- 5433:5432
- ${POSTGRES_PORT}:5432
networks:
- test

redis-test:
image: redis:alpine
container_name: redis-test
ports:
- ${REDIS_PORT}:6379
networks:
- test

Expand Down
22 changes: 11 additions & 11 deletions src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { PollingModule } from './components/polling/polling.module';
import { ReportsModule } from './components/reports/reports.module';
import { UrlChecksModule } from './components/url-checks/url-checks.module';
import { UsersModule } from './components/users/users.module';
// import { BullModule } from '@nestjs/bullmq';
import { BullModule } from '@nestjs/bullmq';

// import { UrlCheckSubscriber } from './url-checks/entities/subscribers/url-check.subscriber';

Expand All @@ -41,16 +41,16 @@ import { UsersModule } from './components/users/users.module';
}),
inject: [ConfigService],
}),
// BullModule.forRootAsync({
// imports: [ConfigModule],
// useFactory: (configService: ConfigService) => ({
// connection: {
// host: configService.get<string>('REDIS_HOST'),
// port: +configService.get('REDIS_PORT'),
// },
// }),
// inject: [ConfigService],
// }),
BullModule.forRootAsync({
imports: [ConfigModule],
useFactory: (configService: ConfigService) => ({
connection: {
host: configService.get<string>('REDIS_HOST'),
port: +configService.get('REDIS_PORT'),
},
}),
inject: [ConfigService],
}),
ScheduleModule.forRoot(),
UsersModule,
AuthModule,
Expand Down
16 changes: 16 additions & 0 deletions test/users/users.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,22 @@ describe('UsersController (e2e)', () => {
});
});

describe('/auth/login (POST) authenticate user', () => {
it('login successfully', () => {
return request(app.getHttpServer())
.post('/auth/login')
.send({ email: 'test@email.com', password: 'test-password' })
.expect(200);
});

it('login unsuccessful', () => {
return request(app.getHttpServer())
.post('/auth/login')
.send({ email: 'test@email.com', password: 'testpassword' })
.expect(401);
});
});

// describe('/users (GET) get all users', () => {
// it('get all users successfully', () => {
// let body: request.Response;
Expand Down

0 comments on commit 7e828e5

Please sign in to comment.