-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(GiniHealthSDKTests): fix use of forced wrap + small refactoring
- Loading branch information
1 parent
b09ce45
commit 447234f
Showing
6 changed files
with
151 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
HealthSDK/GiniHealthSDK/Tests/GiniHealthSDKTests/MockHelpers/FileLoader.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// | ||
// FileLoader.swift | ||
// | ||
// Copyright © 2024 Gini GmbH. All rights reserved. | ||
// | ||
|
||
|
||
import Foundation | ||
|
||
import Foundation | ||
|
||
struct FileLoader { | ||
static func loadFile(withName mockFileName: String, ofType fileType: String) -> Data? { | ||
guard let filePath = Bundle.module.path(forResource: mockFileName, ofType: fileType) else { | ||
print("File not found.") | ||
return nil | ||
} | ||
|
||
let fileURL = URL(fileURLWithPath: filePath) | ||
do { | ||
let data = try Data(contentsOf: fileURL) | ||
return data | ||
} catch { | ||
print("Error loading file:", error) | ||
return nil | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.