Skip to content

Commit cb2628e

Browse files
committed
[FIX] develop 머지 후 테스트 타겟 컴파일 에러 수정
Mock들에 deleteConversations/searchConversations/updateNickname 스텁 추가. ConversationSummary.status 필드 삭제(cc514e2) 이후 방치됐던 관련 테스트도 함께 정리.
1 parent 33dfd51 commit cb2628e

9 files changed

Lines changed: 68 additions & 5 deletions

GAMSSTests/Data/DTO/ConversationSummaryDTOTests.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,12 @@ final class ConversationSummaryDTOTests: XCTestCase {
3535
XCTAssertNil(dto.toDomain(), "createdAt 파싱에 실패하면 잘못된 시간으로 표시하는 대신 목록에서 제외되어야 함")
3636
}
3737

38-
func test_toDomain_mapsIdTitleAndStatus() throws {
38+
func test_toDomain_mapsIdAndTitle() throws {
3939
let dto = makeDTO(createdAt: "2026-08-07T00:00:00Z")
4040

4141
let summary = try XCTUnwrap(dto.toDomain())
4242

4343
XCTAssertEqual(summary.id, 1)
4444
XCTAssertEqual(summary.title, "제목")
45-
XCTAssertEqual(summary.status, "ACTIVE")
4645
}
4746
}

GAMSSTests/Domain/UseCase/DefaultFetchMyProfileUseCaseTests.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ private final class MockMemberRepository: MemberRepository {
1818
fetchMyProfileCallCount += 1
1919
return try stubbedResult.get()
2020
}
21+
22+
func updateNickname(_ nickname: String) async throws -> User {
23+
fatalError("not used in this test")
24+
}
2125
}
2226

2327
final class DefaultFetchMyProfileUseCaseTests: XCTestCase {

GAMSSTests/Domain/UseCase/EndConversationUseCaseTests.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@ private final class MockConversationRepository: ConversationRepository {
3232
receivedConversationId = conversationId
3333
_ = try stubbedEndConversationResult.get()
3434
}
35+
36+
func deleteConversations(_ ids: [Int]) async throws {
37+
fatalError("not used in this test")
38+
}
39+
40+
func searchConversations(_ text: String) async throws -> SearchChatResponseDTO {
41+
fatalError("not used in this test")
42+
}
3543
}
3644

3745
final class EndConversationUseCaseTests: XCTestCase {

GAMSSTests/Domain/UseCase/GetMessagesUseCaseTests.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@ private final class MockConversationRepository: ConversationRepository {
3232
func endConversation(conversationId: Int) async throws {
3333
fatalError("not used in this test")
3434
}
35+
36+
func deleteConversations(_ ids: [Int]) async throws {
37+
fatalError("not used in this test")
38+
}
39+
40+
func searchConversations(_ text: String) async throws -> SearchChatResponseDTO {
41+
fatalError("not used in this test")
42+
}
3543
}
3644

3745
final class GetMessagesUseCaseTests: XCTestCase {

GAMSSTests/Domain/UseCase/SendMessageUseCaseTests.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@ private final class MockConversationRepository: ConversationRepository {
4242
func endConversation(conversationId: Int) async throws {
4343
fatalError("not used in this test")
4444
}
45+
46+
func deleteConversations(_ ids: [Int]) async throws {
47+
fatalError("not used in this test")
48+
}
49+
50+
func searchConversations(_ text: String) async throws -> SearchChatResponseDTO {
51+
fatalError("not used in this test")
52+
}
4553
}
4654

4755
final class SendMessageUseCaseTests: XCTestCase {

GAMSSTests/Domain/UseCase/UpdateConversationTitleUseCaseTests.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ private final class MockConversationRepository: ConversationRepository {
3434
func endConversation(conversationId: Int) async throws {
3535
fatalError("not used in this test")
3636
}
37+
38+
func deleteConversations(_ ids: [Int]) async throws {
39+
fatalError("not used in this test")
40+
}
41+
42+
func searchConversations(_ text: String) async throws -> SearchChatResponseDTO {
43+
fatalError("not used in this test")
44+
}
3745
}
3846

3947
final class UpdateConversationTitleUseCaseTests: XCTestCase {

GAMSSTests/Presentation/ChatViewModelTests.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,14 @@ private final class MockConversationRepository: ConversationRepository {
6666
receivedEndConversationId = conversationId
6767
_ = try stubbedEndConversationResult.get()
6868
}
69+
70+
func deleteConversations(_ ids: [Int]) async throws {
71+
fatalError("not used in this test")
72+
}
73+
74+
func searchConversations(_ text: String) async throws -> SearchChatResponseDTO {
75+
fatalError("not used in this test")
76+
}
6977
}
7078

7179
private final class MockCardRepository: CardRepository {

GAMSSTests/Presentation/ConversationListViewModelTests.swift

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,35 @@ private final class MockConversationRepository: ConversationRepository {
3030
func endConversation(conversationId: Int) async throws {
3131
fatalError("사용 안 함")
3232
}
33+
34+
func deleteConversations(_ ids: [Int]) async throws {
35+
fatalError("사용 안 함")
36+
}
37+
38+
func searchConversations(_ text: String) async throws -> SearchChatResponseDTO {
39+
fatalError("사용 안 함")
40+
}
3341
}
3442

3543
@MainActor
3644
final class ConversationListViewModelTests: XCTestCase {
3745
private func makeViewModel(repository: MockConversationRepository = MockConversationRepository()) -> ConversationListViewModel {
38-
ConversationListViewModel(getIncompleteConversationsUseCase: GetIncompleteConversationsUseCase(conversationRepository: repository))
46+
ConversationListViewModel(
47+
getIncompleteConversationsUseCase: GetIncompleteConversationsUseCase(conversationRepository: repository),
48+
deleteConversationsUseCase: DefaultDeleteConversationsUseCase(conversationRepository: repository),
49+
searchConversationUseCase: DefaultSearchConversationUseCase(conversationRepository: repository)
50+
)
3951
}
4052

4153
func test_load_onSuccess_setsConversationsAndClearsLoading() async {
4254
let repository = MockConversationRepository()
43-
let summary = ConversationSummary(id: 1, title: "제목", status: "ACTIVE", createdAt: Date(timeIntervalSince1970: 0))
55+
let summary = ConversationSummary(id: 1, title: "제목", createdAt: Date(timeIntervalSince1970: 0))
4456
repository.stubbedGetConversationsResult = .success([summary])
4557
let viewModel = makeViewModel(repository: repository)
4658

4759
await viewModel.load()
4860

49-
XCTAssertEqual(viewModel.conversations, [summary])
61+
XCTAssertEqual(viewModel.displayedConversations, [summary])
5062
XCTAssertFalse(viewModel.isLoading)
5163
}
5264

GAMSSTests/Presentation/HomeViewModelTests.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ private final class MockConversationRepository: ConversationRepository {
3939
func endConversation(conversationId: Int) async throws {
4040
fatalError("not used in this test")
4141
}
42+
43+
func deleteConversations(_ ids: [Int]) async throws {
44+
fatalError("not used in this test")
45+
}
46+
47+
func searchConversations(_ text: String) async throws -> SearchChatResponseDTO {
48+
fatalError("not used in this test")
49+
}
4250
}
4351

4452
private final class MockFetchMyProfileUseCase: FetchMyProfileUseCase {

0 commit comments

Comments
 (0)