Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

캘린더 UI 테스트 추가 #83

Merged
merged 3 commits into from
Jan 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions InMyMemory/Domain/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ let package = Package(
name: "UseCases",
targets: ["UseCases"]
),
.library(
name: "DomainTestSupport",
targets: ["DomainTestSupport"]
),
],
dependencies: [
.package(path: "../Shared"),
Expand All @@ -41,6 +45,15 @@ let package = Package(
),
.target(
name: "UseCases",
dependencies: [
"RxSwift",
"Entities",
"Interfaces",
.product(name: "CoreKit", package: "Shared"),
]
),
.target(
name: "DomainTestSupport",
dependencies: [
"RxSwift",
"Swinject",
Expand All @@ -55,6 +68,7 @@ let package = Package(
"UseCases",
"Entities",
"Interfaces",
"DomainTestSupport",
"RxSwift",
.product(name: "CoreKit", package: "Shared"),
"Quick",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
//
// EmotionRepositoryMock.swift
//
//
// Created by 홍성준 on 1/19/24.
//

import Foundation
import Interfaces
import Entities
import RxSwift

public final class EmotionRepositoryMock: EmotionRepositoryInterface {

public init() {}

public var createEmotionCallCount = 0
public var createEmotionEmotion: Emotion?
public func create(emotion: Emotion) -> Single<Void> {
createEmotionCallCount += 1
createEmotionEmotion = emotion
return .just(())
}

public var readEmotionIDCallCount = 0
public var readEmotionIDEmotionID: UUID?
public var readEmotionIDEmotion: Emotion?
public func read(emotionID: UUID) -> Single<Emotion?> {
readEmotionIDCallCount += 1
readEmotionIDEmotionID = emotionID
return .just(readEmotionIDEmotion)
}

Check warning on line 32 in InMyMemory/Domain/Sources/DomainTestSupport/Repositories/EmotionRepositoryMock.swift

View check run for this annotation

Codecov / codecov/patch

InMyMemory/Domain/Sources/DomainTestSupport/Repositories/EmotionRepositoryMock.swift#L28-L32

Added lines #L28 - L32 were not covered by tests

public var readGreaterThanCallCount = 0
public var readGreaterThanDate: Date?
public var readGreaterThanEmotions: [Emotion] = []
public func read(greaterThan date: Date) -> Single<[Emotion]> {
readGreaterThanCallCount += 1
readGreaterThanDate = date
return .just(readGreaterThanEmotions)
}

public var readGreaterOrEqualThanLessThanCallCount = 0
public var readGreaterOrEqualThanLessThanGreaterOrEqualDate: Date?
public var readGreaterOrEqualThanLessThanLessDate: Date?
public var readGreaterOrEqualThanLessThanEmotions: [Emotion] = []
public func read(greaterOrEqualThan greaterOrEqualDate: Date, lessThan lessDate: Date) -> Single<[Emotion]> {
readGreaterOrEqualThanLessThanCallCount += 1
readGreaterOrEqualThanLessThanGreaterOrEqualDate = greaterOrEqualDate
readGreaterOrEqualThanLessThanLessDate = lessDate
return .just(readGreaterOrEqualThanLessThanEmotions)
}

public var readKeywordCallCount = 0
public var readKeywordKeyword: String?
public var readKeywordEmotions: [Emotion] = []
public func read(keyword: String) -> Single<[Emotion]> {
readKeywordCallCount += 1
readKeywordKeyword = keyword
return .just(readKeywordEmotions)
}

public var updateEmotionCallCount = 0
public var updateEmotionEmotion: Emotion?
public func update(emotion: Emotion) -> Single<Void> {
updateEmotionCallCount += 1
updateEmotionEmotion = emotion
return .just(())
}

Check warning on line 69 in InMyMemory/Domain/Sources/DomainTestSupport/Repositories/EmotionRepositoryMock.swift

View check run for this annotation

Codecov / codecov/patch

InMyMemory/Domain/Sources/DomainTestSupport/Repositories/EmotionRepositoryMock.swift#L65-L69

Added lines #L65 - L69 were not covered by tests

public var deleteEmotionCallCount = 0
public var deleteEmotionEmotion: Emotion?
public func delete(emotion: Emotion) -> Single<Void> {
deleteEmotionCallCount += 1
deleteEmotionEmotion = emotion
return .just(())
}

Check warning on line 77 in InMyMemory/Domain/Sources/DomainTestSupport/Repositories/EmotionRepositoryMock.swift

View check run for this annotation

Codecov / codecov/patch

InMyMemory/Domain/Sources/DomainTestSupport/Repositories/EmotionRepositoryMock.swift#L73-L77

Added lines #L73 - L77 were not covered by tests

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
//
// MemoryRepositoryMock.swift
//
//
// Created by 홍성준 on 1/19/24.
//

import Foundation
import Interfaces
import Entities
import RxSwift

public final class MemoryRepositoryMock: MemoryRepositoryInterface {

public init() {}

public var createMemoryCallCount = 0
public var createMemoryMemory: Memory?
public func create(memory: Memory) -> Single<Void> {
createMemoryCallCount += 1
createMemoryMemory = memory
return .just(())
}

Check warning on line 23 in InMyMemory/Domain/Sources/DomainTestSupport/Repositories/MemoryRepositoryMock.swift

View check run for this annotation

Codecov / codecov/patch

InMyMemory/Domain/Sources/DomainTestSupport/Repositories/MemoryRepositoryMock.swift#L19-L23

Added lines #L19 - L23 were not covered by tests

public var readMemoryIDCallCount = 0
public var readMemoryIDMemoryID: UUID?
public var readMemoryIDMemory: Memory?
public func read(memoryID: UUID) -> Single<Memory?>{
readMemoryIDCallCount += 1
readMemoryIDMemoryID = memoryID
return .just(readMemoryIDMemory)
}

public var readGreaterThanCallCount = 0
public var readGreaterThanDate: Date?
public var readGreaterThanMemories: [Memory] = []
public func read(greaterThan date: Date) -> Single<[Memory]> {
readGreaterThanCallCount += 1
readGreaterThanDate = date
return .just(readGreaterThanMemories)
}

public var readGreaterOrEqualThanLessThanCallCount = 0
public var readGreaterOrEqualThanLessThanGreaterOrEqualDate: Date?
public var readGreaterOrEqualThanLessThanLessDate: Date?
public var readGreaterOrEqualThanLessThanMemories: [Memory] = []
public func read(greaterOrEqualThan greaterOrEqualDate: Date, lessThan lessDate: Date) -> Single<[Memory]> {
readGreaterOrEqualThanLessThanCallCount += 1
readGreaterOrEqualThanLessThanGreaterOrEqualDate = greaterOrEqualDate
readGreaterOrEqualThanLessThanLessDate = lessDate
return .just(readGreaterOrEqualThanLessThanMemories)
}

public var readKeywordCallCount = 0
public var readKeywordKeyword: String?
public var readKeywordMemories: [Memory] = []
public func read(keyword: String) -> Single<[Memory]> {
readKeywordCallCount += 1
readKeywordKeyword = keyword
return .just(readKeywordMemories)
}

public var updateMemoryCallCount = 0
public var updateMemoryMemory: Memory?
public func update(memory: Memory) -> Single<Void> {
updateMemoryCallCount += 1
updateMemoryMemory = memory
return .just(())
}

public var deleteMemoryCallCount = 0
public var deleteMemoryMemory: Memory?
public func delete(memory: Memory) -> Single<Void> {
deleteMemoryCallCount += 1
deleteMemoryMemory = memory
return .just(())
}

Check warning on line 77 in InMyMemory/Domain/Sources/DomainTestSupport/Repositories/MemoryRepositoryMock.swift

View check run for this annotation

Codecov / codecov/patch

InMyMemory/Domain/Sources/DomainTestSupport/Repositories/MemoryRepositoryMock.swift#L73-L77

Added lines #L73 - L77 were not covered by tests

public var deleteMemoryIDCallCount = 0
public var deleteMemoryIDMemoryID: UUID?
public func delete(memoryID: UUID) -> Single<Void> {
deleteMemoryIDCallCount += 1
deleteMemoryIDMemoryID = memoryID
return .just(())
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
//
// TodoRepositoryMock.swift
//
//
// Created by 홍성준 on 1/19/24.
//

import Foundation
import Interfaces
import Entities
import RxSwift

public final class TodoRepositoryMock: TodoRepositoryInterface {

public init() {}

public var createTodoCallCount = 0
public var createTodoTodo: Todo?
public func create(todo: Todo) -> Single<Void> {
createTodoCallCount += 1
createTodoTodo = todo
return .just(())
}

Check warning on line 23 in InMyMemory/Domain/Sources/DomainTestSupport/Repositories/TodoRepositoryMock.swift

View check run for this annotation

Codecov / codecov/patch

InMyMemory/Domain/Sources/DomainTestSupport/Repositories/TodoRepositoryMock.swift#L19-L23

Added lines #L19 - L23 were not covered by tests

public var readTodoIDCallCount = 0
public var readTodoIDTodoID: UUID?
public var readTodoIDTodo: Todo?
public func read(todoID: UUID) -> Single<Todo?> {
readTodoIDCallCount += 1
readTodoIDTodoID = todoID
return .just(readTodoIDTodo)
}

Check warning on line 32 in InMyMemory/Domain/Sources/DomainTestSupport/Repositories/TodoRepositoryMock.swift

View check run for this annotation

Codecov / codecov/patch

InMyMemory/Domain/Sources/DomainTestSupport/Repositories/TodoRepositoryMock.swift#L28-L32

Added lines #L28 - L32 were not covered by tests

public var readGreaterThanCallCount = 0
public var readGreaterThanDate: Date?
public var readGreaterThanTodo: [Todo] = []
public func read(greaterThan date: Date) -> Single<[Todo]> {
readGreaterThanCallCount += 1
readGreaterThanDate = date
return .just(readGreaterThanTodo)
}

Check warning on line 41 in InMyMemory/Domain/Sources/DomainTestSupport/Repositories/TodoRepositoryMock.swift

View check run for this annotation

Codecov / codecov/patch

InMyMemory/Domain/Sources/DomainTestSupport/Repositories/TodoRepositoryMock.swift#L37-L41

Added lines #L37 - L41 were not covered by tests

public var readGreaterOrEqualThanLessThanCallCount = 0
public var readGreaterOrEqualThanLessThanGreaterOrEqualDate: Date?
public var readGreaterOrEqualThanLessThanLessDate: Date?
public var readGreaterOrEqualThanLessThanTodos: [Todo] = []
public func read(greaterOrEqualThan greaterOrEqualDate: Date, lessThan lessDate: Date) -> Single<[Todo]> {
readGreaterOrEqualThanLessThanCallCount += 1
readGreaterOrEqualThanLessThanGreaterOrEqualDate = greaterOrEqualDate
readGreaterOrEqualThanLessThanLessDate = lessDate
return .just(readGreaterOrEqualThanLessThanTodos)
}

public var readKeywordCallCount = 0
public var readKeywordKeyword: String?
public var readKeywordTodos: [Todo] = []
public func read(keyword: String) -> Single<[Todo]> {
readKeywordCallCount += 1
readKeywordKeyword = keyword
return .just(readKeywordTodos)
}

public var updateTodoCallCount = 0
public var updateTodoTodo: Todo?
public func update(todo: Todo) -> Single<Void> {
updateTodoCallCount += 1
updateTodoTodo = todo
return .just(())
}

public var deleteTodoCallCount = 0
public var deleteTodoTodo: Todo?
public func delete(todo: Todo) -> Single<Void> {
deleteTodoCallCount += 1
deleteTodoTodo = todo
return .just(())
}

Check warning on line 77 in InMyMemory/Domain/Sources/DomainTestSupport/Repositories/TodoRepositoryMock.swift

View check run for this annotation

Codecov / codecov/patch

InMyMemory/Domain/Sources/DomainTestSupport/Repositories/TodoRepositoryMock.swift#L73-L77

Added lines #L73 - L77 were not covered by tests

}

This file was deleted.

Loading