Skip to content

Commit 2ba3e33

Browse files
Javier Cicchellimr-rock
andcommitted
bugfix/communications (#8)
This PR contains the work done to add a missing public initialiser to the `MockURLRequest` struct of the `Communications` library. In addition, it also implements the `gmt` static property for the `TimeZone+Zone` extension included in the `Core` library. Co-authored-by: Javier Cicchelli <[email protected]> Reviewed-on: https://repo.rock-n-code.com/rock-n-code/swift-libs/pulls/8
1 parent d8163ab commit 2ba3e33

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

Sources/Communications/Classes/MockURLProtocol.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public class MockURLProtocol: URLProtocol {
1717

1818
// MARK: Properties
1919

20+
/// The dictionary in which the mock requests with its respective mock responses will be injected.
2021
public static var mockData: [MockURLRequest: MockURLResponse] = [:]
2122

2223
// MARK: Functions
@@ -75,8 +76,22 @@ public class MockURLProtocol: URLProtocol {
7576

7677
/// This model includes the data to be injected into an specific URL at the time of mocking its request.
7778
public struct MockURLRequest: Hashable {
79+
80+
// MARK: Properties
81+
7882
public let method: HTTPRequestMethod
7983
public let url: URL
84+
85+
// MARK: Initialisers
86+
87+
public init(
88+
method: HTTPRequestMethod,
89+
url: URL
90+
) {
91+
self.method = method
92+
self.url = url
93+
}
94+
8095
}
8196

8297
/// This model includes the data to be injected into an specific URL at the time of mocking its response.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import Foundation
2+
3+
public extension TimeZone {
4+
5+
// MARK: Zones
6+
7+
/// Greenwich Mean Time or UTC+0
8+
static let gmt = TimeZone(secondsFromGMT: 0)
9+
10+
}

0 commit comments

Comments
 (0)