테스트 커버리지 향상: Backend 및 Frontend 100% 달성#620
Conversation
…케이스 추가 - backend/app/db.py (get_sync_database_url, _probe_pooler_admin_console, get_pooler_detection, get_session, get_read_session) 테스트 추가 - frontend/src/components/modals/GroupModal.test.tsx 폼 제출 유효성 검사 테스트 추가 - 프론트엔드/백엔드 전체 테스트 커버리지 100% 달성
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
| await gen.__anext__() | ||
| try: | ||
| await gen.__anext__() | ||
| except StopAsyncIteration: |
|
|
||
| @pytest.fixture(autouse=True) | ||
| def reset_pooler_cache(): | ||
| import app.db |
|
|
||
| @pytest.mark.asyncio | ||
| async def test_get_pooler_detection_cached(): | ||
| import app.db |
|
|
||
| @pytest.mark.asyncio | ||
| async def test_get_read_session_no_readonly(): | ||
| import app.db |
|
|
||
| @pytest.mark.asyncio | ||
| async def test_get_read_session_with_readonly(): | ||
| import app.db |
|
|
||
| @pytest.mark.asyncio | ||
| async def test_get_pooler_detection_locked_cache(): | ||
| import app.db |
|
|
||
| @pytest.mark.asyncio | ||
| async def test_get_read_session_return(): | ||
| import app.db |
| from __future__ import annotations | ||
|
|
||
| import time | ||
| import asyncio |
There was a problem hiding this comment.
Pull request overview
This PR adds missing unit tests to raise overall test coverage to 100%, focusing on backend DB/pooler utilities (app/db.py) and frontend GroupModal form-submit validation paths.
Changes:
- Added React Testing Library tests for
GroupModal’sonSubmitvalidation branches (empty/whitespace vs valid group name). - Added backend tests covering
app/db.pyhelpers: sync URL conversion, pooler admin-console probing, pooler detection caching/locking behavior, and session dependency generators. - Added a short
.Jules/note documenting the coverage-fix approach.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| frontend/src/components/modals/GroupModal.test.tsx | Adds submit-path tests for GroupModal validation and keeps accessibility test coverage. |
| backend/tests/test_db.py | Introduces test coverage for app/db.py pooler detection and session dependencies (needs adjustments to avoid async-mocking/DB brittleness). |
| .Jules/test_coverage_fix.md | Documents the intent and approach of the coverage-focused changes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| import { describe, expect, it, vi } from 'vitest'; | ||
| import { render, screen } from '@testing-library/react'; | ||
| import { render, screen, fireEvent, cleanup } from '@testing-library/react'; | ||
| import { afterEach } from 'vitest'; | ||
|
|
| async def test_get_read_session_with_readonly(): | ||
| import app.db | ||
| app.db.ReadOnlySessionLocal = MagicMock() | ||
| app.db.ReadOnlySessionLocal.return_value.__aenter__.return_value = "readonly_session" | ||
| app.db.SessionLocal = MagicMock() | ||
| app.db.SessionLocal.return_value.__aenter__.return_value = "primary_session" | ||
|
|
| @pytest.mark.asyncio | ||
| async def test_get_session(): | ||
| async for session in get_session(): | ||
| assert session is not None | ||
| break | ||
|
|
| @pytest.mark.asyncio | ||
| async def test_get_read_session_no_readonly(): | ||
| import app.db | ||
| orig = app.db.ReadOnlySessionLocal | ||
| app.db.ReadOnlySessionLocal = None | ||
| try: | ||
| async for session in get_read_session(): | ||
| assert session is not None | ||
| break | ||
| finally: | ||
| app.db.ReadOnlySessionLocal = orig | ||
|
|
| @pytest.mark.asyncio | ||
| async def test_get_read_session_return(): | ||
| import app.db | ||
| orig = app.db.ReadOnlySessionLocal | ||
| app.db.ReadOnlySessionLocal = None | ||
| try: | ||
| gen = get_read_session() | ||
| await gen.__anext__() | ||
| try: | ||
| await gen.__anext__() | ||
| except StopAsyncIteration: | ||
| pass | ||
| finally: | ||
| app.db.ReadOnlySessionLocal = orig |
GroupModal.tsx내 누락된onSubmit유효성 검증 분기점 테스트 추가하여 전체 커버리지 100% 달성PR created automatically by Jules for task 11094039230562261255 started by @seonghobae