Skip to content

Commit

Permalink
add simple test for app component
Browse files Browse the repository at this point in the history
Signed-off-by: Mirko Mollik <[email protected]>
  • Loading branch information
Mirko Mollik committed May 4, 2024
1 parent eccb98b commit e563d72
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion apps/issuer-backend/src/app.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Controller, Get } from '@nestjs/common';
import { ApiOperation } from '@nestjs/swagger';
import { Public } from 'nest-keycloak-connect';

@Controller('app')
@Controller()
export class AppController {

/**
Expand Down
25 changes: 25 additions & 0 deletions apps/issuer-backend/src/app.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { Test, TestingModule } from '@nestjs/testing';
import { INestApplication } from '@nestjs/common';
import * as request from 'supertest';
import { AppController } from './app.controller';

describe('AppController', () => {
let app: INestApplication;

beforeEach(async () => {
const moduleFixture: TestingModule = await Test.createTestingModule({
controllers: [AppController],
}).compile();

app = moduleFixture.createNestApplication();
await app.init();
});

it('/GET health', () => {
return request(app.getHttpServer()).get('/health').expect(200).expect('ok');
});

afterAll(async () => {
await app.close();
});
});

0 comments on commit e563d72

Please sign in to comment.