Skip to content

Commit

Permalink
Merge pull request #504 from ldhbenecia/feature/test-code
Browse files Browse the repository at this point in the history
[Test] e2e 테스트 세팅 및 app e2e 테스트
  • Loading branch information
ldhbenecia authored Jan 2, 2024
2 parents 4cc39c4 + 4f6c0cc commit 897f78f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
10 changes: 7 additions & 3 deletions app/backend/test/app.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Test, TestingModule } from '@nestjs/testing';
import { INestApplication } from '@nestjs/common';
import * as request from 'supertest';
import { AppModule } from './../src/app.module';
import { AppModule } from 'src/app.module';

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

beforeEach(async () => {
beforeAll(async () => {
const moduleFixture: TestingModule = await Test.createTestingModule({
imports: [AppModule],
}).compile();
Expand All @@ -16,6 +16,10 @@ describe('AppController (e2e)', () => {
});

it('/ (GET)', () => {
return request(app.getHttpServer()).get('/').expect(200).expect('Hello World!');
return request(app.getHttpServer()).get('/').expect(200).expect('hello Morak');
});

afterAll(async () => {
await app.close();
});
});
5 changes: 5 additions & 0 deletions app/backend/test/jest-e2e.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,10 @@
"testRegex": ".e2e-spec.ts$",
"transform": {
"^.+\\.(t|j)s$": "ts-jest"
},
"moduleNameMapper": {
"^src/(.*)$": "<rootDir>/../src/$1",
"^prisma/(.*)$": "<rootDir>/../prisma/$1",
"^libs/(.*)$": "<rootDir>/../libs/$1"
}
}
3 changes: 2 additions & 1 deletion app/backend/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"compilerOptions": {
"outDir": "./dist",
"baseUrl": "./",
},
"allowJs": true
}
}

0 comments on commit 897f78f

Please sign in to comment.