test: 식단 기능 테스트 코드 작성 - #523
Conversation
📝 WalkthroughWalkthroughThe PR replaces the legacy unit and UI test targets with ChangesDining unit-test target
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related issues
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@koin.xcodeproj/xcshareddata/xcschemes/koin.xcscheme`:
- Around line 34-40: Update the koin scheme’s TestAction configuration so
koinUnitTests runs against the Debug configuration rather than Release,
preserving testability for its `@testable` import. Alternatively, enable
ENABLE_TESTABILITY only for the koin Release build path used by these tests.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: c4f0021c-5942-4dfe-9415-b3a6419b1718
📒 Files selected for processing (12)
koin.xcodeproj/project.pbxprojkoin.xcodeproj/xcshareddata/xcschemes/NotificationService.xcschemekoin.xcodeproj/xcshareddata/xcschemes/koin-stage.xcschemekoin.xcodeproj/xcshareddata/xcschemes/koin.xcschemekoinUITests/koinUITests.swiftkoinUITests/koinUITestsLaunchTests.swiftkoinUnitTests/Dining/DateProviderTests.swiftkoinUnitTests/Dining/FetchDiningListUseCaseTests.swiftkoinUnitTests/Dining/ShareMenuListUseCaseTests.swiftkoinUnitTests/Doubles/SpyDiningRepository.swiftkoinUnitTests/Support/DiningFixtures.swiftkoinUnitTests/Support/PublisherTestSupport.swift
💤 Files with no reviewable changes (2)
- koinUITests/koinUITestsLaunchTests.swift
- koinUITests/koinUITests.swift
| skipped = "NO" | ||
| parallelizable = "YES"> | ||
| <BuildableReference | ||
| BuildableIdentifier = "primary" | ||
| BlueprintIdentifier = "A001E2C32845091F00D6C310" | ||
| BuildableName = "koinTests.xctest" | ||
| BlueprintName = "koinTests" | ||
| ReferencedContainer = "container:koin.xcodeproj"> | ||
| </BuildableReference> | ||
| </TestableReference> | ||
| <TestableReference | ||
| skipped = "NO"> | ||
| <BuildableReference | ||
| BuildableIdentifier = "primary" | ||
| BlueprintIdentifier = "A001E2CD2845091F00D6C310" | ||
| BuildableName = "koinUITests.xctest" | ||
| BlueprintName = "koinUITests" | ||
| BlueprintIdentifier = "EC692284302700A400EE26ED" | ||
| BuildableName = "koinUnitTests.xctest" | ||
| BlueprintName = "koinUnitTests" |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Verify whether the new test target requires an `@testable` import.
rg -n -C 2 '`@testable`[[:space:]]+import[[:space:]]+koin' koinUnitTests
# Compare the application Debug and Release testability settings.
sed -n '6747,6990p' koin.xcodeproj/project.pbxprojRepository: BCSDLab/KOIN_iOS
Length of output: 11811
🏁 Script executed:
#!/bin/bash
set -euo pipefail
python3 - <<'PY'
from pathlib import Path
import re
proj = Path("koin.xcodeproj/project.pbxproj").read_text()
configs = re.findall(r'(EC69228B302700A400EE26ED|EC69228C302700A400EE26ED|\w{24})\s*/\*\s*(Debug|Release)\s*\*/\s*=\s*\{\s*isa\s*=\s*XCBuildConfiguration;.*?name\s*=\s*(?:Debug|Release);\s*\};', proj, re.S)
for uuid, name in configs:
content = re.search(fr'{re.escape(uuid)}\s*/\*\s*{name}\s*\*/\s*=.*?name\s*=\s*{name};\s*\};', proj, re.S).group(0)
print(f"{uuid} {name} ENABLE_TESTABILITY=", "ENABLE_TESTABILITY = YES" in content)
test_schemes = []
for p in Path("koin.xcodeproj/xcshareddata/xcschemes").glob("*.xcscheme"):
scheme = p.read_text()
if "EC692284302700A400EE26ED" in scheme:
m = re.search(r'<TestAction[^>]*buildConfiguration="([^"]+)"', scheme)
test_schemes.append((p, m.group(1) if m else None, "`@testable` import koin" in scheme))
print("Test schemes:", test_schemes)
all_imports = []
for path in sorted(Path("koinUnitTests").rglob("*.swift")):
all_imports.extend(path.read_text(errors="ignore").splitlines())
print("Files using `@testable` import koin:", sum(1 for line in all_imports if "`@testable` import koin" in line))
print("All references:", [f"{p}:{line_no}" for p in all_imports[:0]])
PYRepository: BCSDLab/KOIN_iOS
Length of output: 447
🏁 Script executed:
#!/bin/bash
set -euo pipefail
python3 - <<'PY'
from pathlib import Path
import re
proj = Path("koin.xcodeproj/project.pbxproj").read_text()
uuids = [
"EC69228B302700A400EE26ED",
"EC69228C302700A400EE26ED",
]
for uuid in uuids:
m = re.search(rf'({re.escape(uuid)})\s*/\*\s*(Debug|Release)\s*\*/', proj)
if not m:
continue
uuid, name = m.groups()
full = re.search(rf'{re.escape(uuid)}\s*/\*\s*{re.escape(name)}\s*\*/\s*=.*?name\s*=\s*{re.escape(name)};\s*\};', proj, re.S).group(0)
print(f"{uuid} {name} ENABLE_TESTABILITY=", "ENABLE_TESTABILITY = YES" in full)
test_schemes = []
schemes_dir = Path("koin.xcodeproj/xcshareddata/xcschemes")
if schemes_dir.exists():
for p in sorted(schemes_dir.glob("*.xcscheme")):
scheme = p.read_text()
if "EC692284302700A400EE26ED" in scheme:
mt = re.search(r'<TestAction[^>]*buildConfiguration="([^"]+)"', scheme)
mi = re.search(r'`@testable`\s+import\s+koin', scheme)
test_schemes.append((str(p), mt.group(1) if mt else None, bool(mi)))
print("Test schemes:", test_schemes)
all_imports = []
for path in sorted(Path("koinUnitTests").rglob("*.swift")):
all_imports.extend(path.read_text(errors="ignore").splitlines())
print("Files using `@testable` import koin:", sum(1 for line in all_imports if "`@testable` import koin" in line))
PY
python3 - <<'PY'
from pathlib import Path
files = {}
for path in sorted(Path("koinUnitTests").rglob("*.swift")):
text = path.read_text(errors="ignore").splitlines()
hits = [(i+1, line.strip()) for i, line in enumerate(text) if "`@testable` import koin" in line]
if hits:
files[str(path)] = hits
print("koinUnitTests files with `@testable` import koin:")
for path, hits in files.items():
print(path)
for i, line in hits[:5]:
print(f" {i}: {line}")
if len(hits) > 5:
print(f" ... and {len(hits)-5} more")
PYRepository: BCSDLab/KOIN_iOS
Length of output: 486
🏁 Script executed:
#!/bin/bash
set -euo pipefail
python3 - <<'PY'
from pathlib import Path
import re
proj = Path("koin.xcodeproj/project.pbxproj").read_text()
uuid_config_map = {
"EC69228B302700A400EE26ED": "Debug",
"EC69228C302700A400EE26ED": "Release",
}
for uuid, name in uuid_config_map.items():
escaped_uuid = re.escape(uuid)
escaped_name = re.escape(name)
m = re.search(rf'{escaped_uuid}\s*/\*\s*{escaped_name}\s*\*/', proj)
if not m:
continue
full = re.search(rf'{escaped_uuid}\s*/\*\s*{escaped_name}\s*\*/\s*=.*?name\s*=\s*{escaped_name};\s*\};', proj, re.S).group(0)
has_setting = "ENABLE_TESTABILITY = YES" in full
print(f"{uuid} {name} ENABLE_TESTABILITY= {has_setting}")
test_schemes = []
schemes_dir = Path("koin.xcodeproj/xcshareddata/xcschemes")
if schemes_dir.exists():
for p in sorted(schemes_dir.glob("*.xcscheme")):
scheme = p.read_text()
if "EC692284302700A400EE26ED" in scheme:
mt = re.search(r'<TestAction[^>]*buildConfiguration="([^"]+)"', scheme)
mi = re.search(r'`@testable`\s+import\s+koin', scheme)
test_schemes.append((str(p), mt.group(1) if mt else None, bool(mi)))
print("Test schemes:", test_schemes)
files = {}
for path in sorted(Path("koinUnitTests").rglob("*.swift")):
text = path.read_text(errors="ignore").splitlines()
hits = [(i+1, line.strip()) for i, line in enumerate(text) if "`@testable` import koin" in line]
if hits:
files[str(path)] = hits
print("koinUnitTests files with `@testable` import koin:", len(files))
for path, hits in list(files.items())[:5]:
print(path)
for i, line in hits[:5]:
print(f" {i}: {line}")
PYRepository: BCSDLab/KOIN_iOS
Length of output: 468
Don’t run @testable tests from a Release scheme.
koinUnitTests uses @testable import koin, but the koin Release configuration does not enable testability. Use Debug for TestAction, or enable ENABLE_TESTABILITY = YES for koin only in the Release build path used by tests.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@koin.xcodeproj/xcshareddata/xcschemes/koin.xcscheme` around lines 34 - 40,
Update the koin scheme’s TestAction configuration so koinUnitTests runs against
the Debug configuration rather than Release, preserving testability for its
`@testable` import. Alternatively, enable ENABLE_TESTABILITY only for the koin
Release build path used by these tests.
#️⃣연관된 이슈
📝작업 내용
💬리뷰 요구사항(선택)