Skip to content

Commit

Permalink
fix: rebase 하며 사라진 부분 다시 채워넣음 #182
Browse files Browse the repository at this point in the history
  • Loading branch information
koomchang committed Nov 28, 2024
1 parent 61c87c9 commit 20c057e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 2 additions & 0 deletions backend/test/map/integration-test/map.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
createPlace,
createPrivateMaps,
createPublicMaps,
createPublicMapsWithTitle,
} from '@test/map/map.test.util';
import { Map } from '@src/map/entity/map.entity';
import { Color } from '@src/place/place.color.enum';
Expand All @@ -28,6 +29,7 @@ import {
} from '@test/config/utils';
import { INestApplication } from '@nestjs/common';
import { DataSource } from 'typeorm';
import { MapPlace } from '@src/map/entity/map-place.entity';

describe('MapController 통합 테스트', () => {
let app: INestApplication;
Expand Down
10 changes: 7 additions & 3 deletions backend/test/map/map.repository.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@ import {
createPrivateMaps,
createPublicMaps,
} from '@test/map/map.test.util';
import { PlaceRepository } from '@src/place/place.repository';
import { MapPlace } from '@src/map/entity/map-place.entity';
import { Color } from '@src/place/place.color.enum';
import { Place } from '@src/place/entity/place.entity';

describe('MapRepository', () => {
let container: StartedMySqlContainer;
let mapRepository: MapRepository;
let placeRepository: PlaceRepository;
let dataSource: DataSource;
let fakeUser1: User;
let fakeUser2: User;
Expand All @@ -36,6 +35,8 @@ describe('MapRepository', () => {
fakeUser1 = UserFixture.createUser({ oauthId: 'abc' });
fakeUser2 = UserFixture.createUser({ oauthId: 'def' });
await dataSource.getRepository(User).save([fakeUser1, fakeUser2]);
const places = createPlace(5);
await dataSource.getRepository(Place).save(places);
});

afterAll(async () => {
Expand Down Expand Up @@ -63,14 +64,17 @@ describe('MapRepository', () => {
const fiftyPublicMaps = createPublicMaps(50, fakeUser1);
await mapRepository.save(fiftyPublicMaps);
const [page, pageSize] = [5, 5];
const fifthPageMaps = await mapRepository.findAll(page, pageSize);
const expectedMaps = fiftyPublicMaps.slice(20, 25);

const fifthPageMaps = await mapRepository.findAll(page, pageSize);

expect(fifthPageMaps).toEqual(
expect.arrayContaining(
expectedMaps.map((expectedMap) => expect.objectContaining(expectedMap)),
),
);
});

describe('searchByTitleQuery 메소드 테스트', () => {
it('대소문자 구분없이 제목으로 지도를 검색할 수 있다', async () => {
const searchedMaps = [
Expand Down
1 change: 0 additions & 1 deletion backend/test/map/map.service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import { ConfigModule } from '@nestjs/config';
import { JWTHelper } from '@src/auth/JWTHelper';
import { UpdateMapInfoRequest } from '@src/map/dto/UpdateMapInfoRequest';
import { truncateTables } from '@test/config/utils';
import { initMapUserPlaceTable } from '@test/map/integration-test/map.integration.util';
import { MapPlace } from '@src/map/entity/map-place.entity';

describe('MapService 테스트', () => {
Expand Down

0 comments on commit 20c057e

Please sign in to comment.