Skip to content

[FEAT] 퀴즈 추가#136

Merged
dgh06175 merged 3 commits into
developfrom
be/134-feat-퀴즈-추가
Mar 23, 2026

Hidden character warning

The head ref may contain hidden characters: "be/134-feat-\ud034\uc988-\ucd94\uac00"
Merged

[FEAT] 퀴즈 추가#136
dgh06175 merged 3 commits into
developfrom
be/134-feat-퀴즈-추가

Conversation

@dgh06175

Copy link
Copy Markdown
Contributor

📄 작업 내용 요약

CS 관련 퀴즈를 50개 추가했습니다.

🏷️ Release 라벨

📎 Issue 134

closed #134

@dgh06175 dgh06175 self-assigned this Mar 23, 2026
Copilot AI review requested due to automatic review settings March 23, 2026 13:14
@dgh06175 dgh06175 added this to Gulab Mar 23, 2026
@dgh06175 dgh06175 added feat 기능 개발 BE 백엔드 labels Mar 23, 2026
@dgh06175 dgh06175 linked an issue Mar 23, 2026 that may be closed by this pull request
@github-project-automation github-project-automation Bot moved this to Backlog in Gulab Mar 23, 2026
@dgh06175 dgh06175 merged commit 46a48cb into develop Mar 23, 2026
2 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Gulab Mar 23, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

CS 퀴즈 카탈로그(quiz.json)에 신규 퀴즈(요구사항: 5개 분야 각 10문항)를 추가하고, 퀴즈 데이터 확장에 맞춰 서버 단위 테스트가 고정 개수/choiceId 가정에 덜 의존하도록 보완한 PR입니다.

Changes:

  • quiz/quiz.json에 CS 퀴즈를 대량 추가하고, 기존 항목의 choiceId/correctChoiceId를 조정(전역 유일 ID 형태) 및 포맷 정리
  • QuizMemoryRepositoryTest에서 “요청 수 > 보유 수” 케이스를 실제 카탈로그의 카테고리별 보유 개수 기반으로 검증하도록 개선
  • GameServiceTest에 choiceId가 전역으로 유일한 경우에도 번호 매핑/제출/채점 흐름이 정상 동작하는지 검증하는 테스트 추가

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
sigkill-server/src/test/java/com/gulab/sigkillserver/domain/game/service/GameServiceTest.java 전역 유일 choiceId 데이터로도 매핑/제출/채점이 정상 동작함을 검증하는 케이스 추가 및 테스트 유틸 추가
sigkill-server/src/test/java/com/gulab/sigkillserver/domain/game/repository/QuizMemoryRepositoryTest.java 카탈로그 확장에 따라 고정값(10개) 가정을 제거하고 실제 리소스 기준으로 검증하도록 수정
sigkill-server/src/main/resources/quiz/quiz.json CS 퀴즈 대량 추가 및 기존 choiceId/correctChoiceId 조정/정리(포맷 포함)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1106 to +1122
QuizStartEvent startEvent = gameService.startQuiz(host.getUserId(), room.getRoomId(), game.getGameId());
QuizChoiceNumberMapping mapping = quizChoiceNumberMappingRepository
.findByGameIdAndQuizId(game.getGameId(), startEvent.payload().quiz().quizId())
.orElseThrow();
int correctNumber = mapping.getNumberToChoiceId().entrySet().stream()
.filter(entry -> entry.getValue().equals(1001L))
.map(Map.Entry::getKey)
.findFirst()
.orElseThrow();

gameService.submitChoice(host.getUserId(), game.getGameId(), 9001L, correctNumber);
QuizEndEvent result = gameService.endQuiz(
host.getUserId(),
room.getRoomId(),
game.getGameId(),
9001L
).quizEndEvent();

Copilot AI Mar 23, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ChoiceIdBehaviorTests에서 submitChoice/endQuiz 호출 시 quizId를 9001L로 하드코딩하고 있는데, 실제로는 startQuiz() 결과의 quizId에 따라 테스트가 더 견고해집니다. startEvent.payload().quiz().quizId()(또는 별도 변수)에 맞춰 submit/endQuiz 인자를 구성하면 향후 퀴즈 선택/정렬 로직 변경에도 테스트가 불필요하게 깨지지 않습니다.

Copilot uses AI. Check for mistakes.
Comment on lines +139 to +153
private void replaceQuizRepository(Resource resource) {
quizRepository = new QuizMemoryRepository(new ObjectMapper(), resource);
gameService = new GameService(
userRepository,
gameRepository,
quizRepository,
playerRepository,
roomRepository,
selectedChoiceRepository,
quizChoiceNumberMappingRepository,
gamePlayerRepository,
gameEventBuilder,
roomLockManager
);
}

Copilot AI Mar 23, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replaceQuizRepositorysetUp()의 GameService 생성 로직을 거의 그대로 복제하고 있어, 생성자 인자/초기화 순서가 바뀔 때 테스트 코드가 쉽게 드리프트할 수 있습니다. 공통으로 GameService를 생성하는 private 팩토리 메서드로 추출하거나, setUp에서 사용하는 ObjectMapper 인스턴스를 재사용하도록 리팩터링하는 편이 유지보수에 안전합니다.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BE 백엔드 feat 기능 개발

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[FEAT] 퀴즈 추가

2 participants