Skip to content

Commit

Permalink
Final Code for NSJS387
Browse files Browse the repository at this point in the history
  • Loading branch information
manikbajaj committed Jun 21, 2024
1 parent 7c48bd6 commit d03b41f
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion test/users/users.post.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import * as request from 'supertest';

import { App } from 'supertest/types';
import { ConfigService } from '@nestjs/config';
import { INestApplication } from '@nestjs/common';
import { bootstrapNestApplication } from 'test/helpers/bootstrap-nest-application.helper';
Expand All @@ -6,20 +9,31 @@ import { dropDatabase } from 'test/helpers/drop-database.helper';
describe('[Users] @Post Endpoints', () => {
let app: INestApplication;
let config: ConfigService;
let httpServer: App;

beforeEach(async () => {
// Instantiate the app
app = await bootstrapNestApplication();
// Get the config
config = app.get<ConfigService>(ConfigService);
// get server endpoint
httpServer = app.getHttpServer();
});

afterEach(async () => {
await dropDatabase(config);
await app.close();
});

it.todo('/users - Endpoint is public');
it('/users - Endpoint is public', () => {
return request(httpServer)
.post('/users')
.send({})
.then((data) => {
console.log(data);
});
});

it.todo('/users - firstName is mandatory');
it.todo('/users - lastName is mandatory');
it.todo('/users - email is mandatory');
Expand Down

0 comments on commit d03b41f

Please sign in to comment.