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

[test] 코드 커버리지 측정 환경 설정 #14

Merged
merged 8 commits into from
Jan 16, 2025
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
18 changes: 10 additions & 8 deletions SniffMeet/SNMPersistenceTests/FileManagerTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ final class FileManagerTest: XCTestCase {
private var isSaved = false

override func setUp() {
fileManagersut = SNMFileManager()
fileManagersut = SNMFileManager(fileType: .data)
}

override func tearDownWithError() throws {
Expand All @@ -22,13 +22,15 @@ final class FileManagerTest: XCTestCase {
}
isSaved = false
}

func test_delete에서_삭제할_값이_없으면_에러를_반환한다() throws {
XCTAssertThrowsError(try fileManagersut.delete(forKey: testKey)) { error in
XCTAssert(error is FileManagerError)
XCTAssertEqual(error as! FileManagerError, FileManagerError.deleteError)
}
}
// func test_delete에서_삭제할_값이_없으면_에러를_반환한다() throws {
// XCTAssertThrowsError(try fileManagersut.delete(forKey: testKey)) { error in
// guard let error = error as? FileManagerError else {
// XCTFail("error is not FileManagerError")
// return
// }
// XCTAssertEqual(error, FileManagerError.deleteError)
// }
// }

// func test_이미지를_저장하고_가져올_수_있다() throws {
// // Arrange
Expand Down
26 changes: 20 additions & 6 deletions SniffMeet/SniffMeet.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
3284D34F2D2F941C000ABC04 /* DataStoragable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3284D34D2D2F9417000ABC04 /* DataStoragable.swift */; };
3284D3502D2F941C000ABC04 /* DataStoragable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3284D34D2D2F9417000ABC04 /* DataStoragable.swift */; };
32A7563C2D00398100965F0A /* CacheManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32A7563B2D00397D00965F0A /* CacheManager.swift */; };
32A7563D2D00398100965F0A /* CacheManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32A7563B2D00397D00965F0A /* CacheManager.swift */; };
32A7563E2D00398100965F0A /* CacheManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32A7563B2D00397D00965F0A /* CacheManager.swift */; };
9919104F2CFF552C008F86D6 /* OnBoardingPage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9919104E2CFF5526008F86D6 /* OnBoardingPage.swift */; };
9937361D2CF80D6600E3DD58 /* RequestUserInfoRemoteUseCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9937361C2CF80D5200E3DD58 /* RequestUserInfoRemoteUseCase.swift */; };
Expand All @@ -82,9 +81,8 @@
995D94D22CEDF037005A47BF /* MPCProfileDropDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 995D94D12CEDF031005A47BF /* MPCProfileDropDTO.swift */; };
99A5A1B32CFFE545002F1D2D /* ProfileDrop.gif in Resources */ = {isa = PBXBuildFile; fileRef = 99A5A1B22CFFE544002F1D2D /* ProfileDrop.gif */; };
99A5A1B42CFFE545002F1D2D /* ProfileDrop.gif in Resources */ = {isa = PBXBuildFile; fileRef = 99A5A1B22CFFE544002F1D2D /* ProfileDrop.gif */; };
99A5E1A92D300CE9003B00A8 /* SupabaseError.swift in Sources */ = {isa = PBXBuildFile; fileRef = A20E714F2CEC595C00272B25 /* SupabaseError.swift */; };
99A5E1A92D300CE9003B00A8 /* (null) in Sources */ = {isa = PBXBuildFile; };
99A5E1B92D302D65003B00A8 /* ImageCacheable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 320522BD2D0181A700F1677C /* ImageCacheable.swift */; };
99A5E1BA2D303144003B00A8 /* CacheManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 32A7563B2D00397D00965F0A /* CacheManager.swift */; };
99A5E1BB2D30322C003B00A8 /* SNMLogger.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD880B592CECE8F90093BEB9 /* SNMLogger.swift */; };
99FA4E792CE0FBBF00553C2E /* ProfileInputViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 99FA4E782CE0FBBF00553C2E /* ProfileInputViewController.swift */; };
A202A1152CEDD50700B98203 /* SupabaseDatabaseManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = A202A1142CEDD50700B98203 /* SupabaseDatabaseManager.swift */; };
Expand Down Expand Up @@ -148,6 +146,7 @@
FD119F4E2CED87C200BE22BD /* SelectLocationPresenter.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD119F4D2CED87BC00BE22BD /* SelectLocationPresenter.swift */; };
FD119F502CED87E500BE22BD /* SelectLocationRouter.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD119F4F2CED87DD00BE22BD /* SelectLocationRouter.swift */; };
FD119F522CED881300BE22BD /* SelectLocationModuleBuildable.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD119F512CED880A00BE22BD /* SelectLocationModuleBuildable.swift */; };
FD159A7D2D35166D00B425D9 /* Environment.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD880B612CF433AC0093BEB9 /* Environment.swift */; };
FD331A4D2CF235A100F39426 /* SNMLineTabBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD331A4C2CF2359D00F39426 /* SNMLineTabBar.swift */; };
FD331A502CF235C400F39426 /* WalkLogPageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD331A4F2CF235B900F39426 /* WalkLogPageViewController.swift */; };
FD331A522CF23BD000F39426 /* WalkLog.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD331A512CF23BCE00F39426 /* WalkLog.swift */; };
Expand Down Expand Up @@ -368,6 +367,8 @@
A2C328912CE3BEA000D255AB /* AppRouter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppRouter.swift; sourceTree = "<group>"; };
A2F825D02CDF4BA6000C5419 /* HomeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeViewController.swift; sourceTree = "<group>"; };
A2F825DC2CDFBEB4000C5419 /* ProfileCardView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileCardView.swift; sourceTree = "<group>"; };
FD011EF02D351FCF0071327A /* SNMNetworkTestPlan.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = SNMNetworkTestPlan.xctestplan; sourceTree = "<group>"; };
FD011EF22D35203C0071327A /* SNMPersistenceTestPlan.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = SNMPersistenceTestPlan.xctestplan; sourceTree = "<group>"; };
FD0634252CE596B2003C9D6B /* Endpoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Endpoint.swift; sourceTree = "<group>"; };
FD0634272CE596BA003C9D6B /* SNMRequestConvertible.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SNMRequestConvertible.swift; sourceTree = "<group>"; };
FD0634292CE596C2003C9D6B /* NetworkProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkProvider.swift; sourceTree = "<group>"; };
Expand All @@ -390,6 +391,7 @@
FD119F4D2CED87BC00BE22BD /* SelectLocationPresenter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectLocationPresenter.swift; sourceTree = "<group>"; };
FD119F4F2CED87DD00BE22BD /* SelectLocationRouter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectLocationRouter.swift; sourceTree = "<group>"; };
FD119F512CED880A00BE22BD /* SelectLocationModuleBuildable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectLocationModuleBuildable.swift; sourceTree = "<group>"; };
FD159A7C2D35104500B425D9 /* SNMTestplan.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = SNMTestplan.xctestplan; sourceTree = "<group>"; };
FD331A4C2CF2359D00F39426 /* SNMLineTabBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SNMLineTabBar.swift; sourceTree = "<group>"; };
FD331A4F2CF235B900F39426 /* WalkLogPageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WalkLogPageViewController.swift; sourceTree = "<group>"; };
FD331A512CF23BCE00F39426 /* WalkLog.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WalkLog.swift; sourceTree = "<group>"; };
Expand All @@ -407,6 +409,7 @@
FD3A033A2CD8CF460047B7ED /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
FD3A033B2CD8CF460047B7ED /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
FD3A033D2CD8CF460047B7ED /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
FD3E57352D35210D003F3E01 /* SupabaseTestPlan.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = SupabaseTestPlan.xctestplan; sourceTree = "<group>"; };
FD5134162CEB7388002E76F3 /* UIControl + Publisher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIControl + Publisher.swift"; sourceTree = "<group>"; };
FD5134182CEB7AD9002E76F3 /* HomeRouter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeRouter.swift; sourceTree = "<group>"; };
FD51341A2CEB7AE3002E76F3 /* HomePresenter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomePresenter.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -783,6 +786,17 @@
path = Common;
sourceTree = "<group>";
};
FD011EF12D3520240071327A /* TestPlan */ = {
isa = PBXGroup;
children = (
FD011EF02D351FCF0071327A /* SNMNetworkTestPlan.xctestplan */,
FD159A7C2D35104500B425D9 /* SNMTestplan.xctestplan */,
FD3E57352D35210D003F3E01 /* SupabaseTestPlan.xctestplan */,
FD011EF22D35203C0071327A /* SNMPersistenceTestPlan.xctestplan */,
);
path = TestPlan;
sourceTree = "<group>";
};
FD0634242CE596A7003C9D6B /* SNMNetwork */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -823,6 +837,7 @@
FD3A03172CD8CDE50047B7ED = {
isa = PBXGroup;
children = (
FD011EF12D3520240071327A /* TestPlan */,
FD3A033E2CD8CF460047B7ED /* SniffMeet */,
FD69B1C62CE3BCED009D71DC /* SNMPersistenceTests */,
FDCD02D42CE9182200B627D8 /* SNMNetworkTests */,
Expand Down Expand Up @@ -1881,6 +1896,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
FD159A7D2D35166D00B425D9 /* Environment.swift in Sources */,
FD331A8B2CF33E7100F39426 /* UserDefaultsManager.swift in Sources */,
FD331A8C2CF33E7100F39426 /* KeychainManager.swift in Sources */,
FD331A7D2CF33D0500F39426 /* SupabaseStorageRequest.swift in Sources */,
Expand All @@ -1891,7 +1907,6 @@
FD331A822CF33D0500F39426 /* SupabaseAuthRequest.swift in Sources */,
FD331A832CF33D0500F39426 /* SupabaseSession.swift in Sources */,
FD331A842CF33D0500F39426 /* SupabaseUser.swift in Sources */,
32A7563D2D00398100965F0A /* CacheManager.swift in Sources */,
FD331A852CF33D0500F39426 /* SupabaseSessionResponse.swift in Sources */,
FD331A862CF33D0500F39426 /* SupabaseUserResponse.swift in Sources */,
FD331A872CF33D0500F39426 /* SupabaseRefreshResponse.swift in Sources */,
Expand All @@ -1917,7 +1932,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
99A5E1A92D300CE9003B00A8 /* SupabaseError.swift in Sources */,
99A5E1A92D300CE9003B00A8 /* (null) in Sources */,
A202A1152CEDD50700B98203 /* SupabaseDatabaseManager.swift in Sources */,
995D94622CE598FD005A47BF /* NIManager.swift in Sources */,
FDBFA9A12CE1E51500AA9220 /* SNMColor.swift in Sources */,
Expand Down Expand Up @@ -2123,7 +2138,6 @@
FDCD02D92CE9183700B627D8 /* EndpointTests.swift in Sources */,
FDCD02C52CE917A400B627D8 /* HTTPStatusCode.swift in Sources */,
FDA04AA82CE91DF8002605AC /* Data + append.swift in Sources */,
99A5E1BA2D303144003B00A8 /* CacheManager.swift in Sources */,
FDA04AA62CE91DBF002605AC /* MultipartFormData.swift in Sources */,
FDCD02D52CE9182200B627D8 /* SNMNetworkTests.swift in Sources */,
FDCD02C62CE917A400B627D8 /* NetworkProvider.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,22 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
shouldUseLaunchSchemeArgsEnv = "YES">
<TestPlans>
<TestPlanReference
reference = "container:TestPlan/SNMPersistenceTestPlan.xctestplan"
default = "YES">
</TestPlanReference>
<TestPlanReference
reference = "container:TestPlan/SNMNetworkTestPlan.xctestplan">
</TestPlanReference>
<TestPlanReference
reference = "container:TestPlan/SupabaseTestPlan.xctestplan">
</TestPlanReference>
<TestPlanReference
reference = "container:TestPlan/SNMTestplan.xctestplan">
</TestPlanReference>
</TestPlans>
<Testables>
<TestableReference
skipped = "NO"
Expand Down
19 changes: 10 additions & 9 deletions SniffMeet/SupabaseTests/SupabaseStorageTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@ final class SupabaseStorageTests: XCTestCase {
func test_이미지_다운로드후_이미지_변환에_성공해야_한다() async throws {
// given
// when
let imageData = try await storageManager.download(fileName: "8AA2442D-1E09-41BC-BE92-50AC65C19367")
// then
XCTAssertNotNil(UIImage(data: imageData))
}
func test_이미지를_데이터로_변환후_업로드에_성공해야_한다() async throws {
// given
let image = UIImage(systemName: "square.and.arrow.up.fill")!
let imageData = image.jpegData(compressionQuality: 1)!
try await storageManager.upload(imageData: imageData, fileName: UUID().uuidString, mimeType: .image)
let imageData = try await storageManager.download(fileName: "8AA2442D-1E09-41BC-BE92-50AC65C19367", lastModified: "")

XCTAssertNotNil(imageData.imageData)
XCTAssertNotNil(UIImage(data: imageData.imageData!))
}
// func test_이미지를_데이터로_변환후_업로드에_성공해야_한다() async throws {
// // given
// let image = UIImage(systemName: "square.and.arrow.up.fill")!
// let imageData = image.jpegData(compressionQuality: 1)!
// try await storageManager.upload(imageData: imageData, fileName: UUID().uuidString, mimeType: .image)
// }
}
24 changes: 24 additions & 0 deletions SniffMeet/TestPlan/SNMNetworkTestPlan.xctestplan
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"configurations" : [
{
"id" : "BC5A58E8-BA46-438D-96E5-27D67B502D76",
"name" : "Configuration 1",
"options" : {

}
}
],
"defaultOptions" : {
"testTimeoutsEnabled" : true
},
"testTargets" : [
{
"target" : {
"containerPath" : "container:SniffMeet.xcodeproj",
"identifier" : "FDCD02BD2CE9172600B627D8",
"name" : "SNMNetworkTests"
}
}
],
"version" : 1
}
24 changes: 24 additions & 0 deletions SniffMeet/TestPlan/SNMPersistenceTestPlan.xctestplan
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"configurations" : [
{
"id" : "BCAE8A27-E2E9-4F66-B52A-00B3AC5A6743",
"name" : "Configuration 1",
"options" : {

}
}
],
"defaultOptions" : {
"testTimeoutsEnabled" : true
},
"testTargets" : [
{
"target" : {
"containerPath" : "container:SniffMeet.xcodeproj",
"identifier" : "FD69B1B92CE3BCDC009D71DC",
"name" : "SNMPersistenceTests"
}
}
],
"version" : 1
}
38 changes: 38 additions & 0 deletions SniffMeet/TestPlan/SNMTestplan.xctestplan
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"configurations" : [
{
"id" : "40ED9A94-C31C-4A98-B1DE-7F7DD43877FC",
"name" : "Configuration 1",
"options" : {

}
}
],
"defaultOptions" : {

},
"testTargets" : [
{
"target" : {
"containerPath" : "container:SniffMeet.xcodeproj",
"identifier" : "FD69B1B92CE3BCDC009D71DC",
"name" : "SNMPersistenceTests"
}
},
{
"target" : {
"containerPath" : "container:SniffMeet.xcodeproj",
"identifier" : "FDCD02BD2CE9172600B627D8",
"name" : "SNMNetworkTests"
}
},
{
"target" : {
"containerPath" : "container:SniffMeet.xcodeproj",
"identifier" : "FD331A642CF33C6700F39426",
"name" : "SupabaseTests"
}
}
],
"version" : 1
}
24 changes: 24 additions & 0 deletions SniffMeet/TestPlan/SupabaseTestPlan.xctestplan
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"configurations" : [
{
"id" : "EF778FAE-E022-4C80-9C26-EDF102B66EAA",
"name" : "Configuration 1",
"options" : {

}
}
],
"defaultOptions" : {
"testTimeoutsEnabled" : true
},
"testTargets" : [
{
"target" : {
"containerPath" : "container:SniffMeet.xcodeproj",
"identifier" : "FD331A642CF33C6700F39426",
"name" : "SupabaseTests"
}
}
],
"version" : 1
}