Skip to content

Commit

Permalink
fix: beforeAll 로 데이터베이스 초기화/ Color 사용 방법 변경 #166
Browse files Browse the repository at this point in the history
  • Loading branch information
hyohyo12 committed Nov 27, 2024
1 parent f017d77 commit 0ee7f5d
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions backend/test/map/integration-test/map.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ describe('MapController 통합 테스트', () => {
placeRepository = new PlaceRepository(dataSource);
userRepository = new UserRepository(dataSource);

await userRepository.query(`ALTER TABLE USER AUTO_INCREMENT = 1`);
await userRepository.delete({});
await initMapUserPlaceTable(mapRepository, userRepository, placeRepository);

const [fakeUser1Entity, fakeUser2Entity] = await userRepository.save([
fakeUser1,
Expand Down Expand Up @@ -241,7 +240,7 @@ describe('MapController 통합 테스트', () => {
publicMapsWithPlace.forEach((publicMapWithPlace) => {
publicMapWithPlace.mapPlaces = [];
publicMapWithPlace.mapPlaces.push(
MapPlace.of(1, publicMapWithPlace, 'RED' as Color, 'test'),
MapPlace.of(1, publicMapWithPlace, Color.RED, 'test'),
);
});
await mapRepository.save([
Expand Down Expand Up @@ -272,27 +271,30 @@ describe('MapController 통합 테스트', () => {
});

it('GET /maps?query 에 대한 요청으로 공개 되어있고 query 와 유사한 title을 가지는 지도들을 반환한다.', async () => {
const coolMaps = createPublicMapsWithTitle(
const publicMapsWithCoolTitle = createPublicMapsWithTitle(
2,
fakeUser1,
'cool test title',
);
const coolMapsWithPlace = createPublicMapsWithTitle(
const publicMapsWithCoolTitleAndPlace = createPublicMapsWithTitle(
3,
fakeUser1,
'cool title',
);
const privateMaps = createPrivateMaps(5, fakeUser1);
coolMapsWithPlace.forEach((publicMapWithPlace) => {
publicMapsWithCoolTitleAndPlace.forEach((publicMapWithPlace) => {
publicMapWithPlace.mapPlaces = [];
publicMapWithPlace.mapPlaces.push(
MapPlace.of(1, publicMapWithPlace, 'RED' as Color, 'test'),
MapPlace.of(1, publicMapWithPlace, Color.RED, 'test'),
);
});
coolMaps.forEach((publicMap) => {
publicMapsWithCoolTitle.forEach((publicMap) => {
publicMap.mapPlaces = [];
});
const publicMaps = [...coolMaps, ...coolMapsWithPlace];
const publicMaps = [
...publicMapsWithCoolTitle,
...publicMapsWithCoolTitleAndPlace,
];
await mapRepository.save([...publicMaps, ...privateMaps]);

return request(app.getHttpServer())
Expand Down

0 comments on commit 0ee7f5d

Please sign in to comment.