Skip to content

Commit

Permalink
bugfix/communications (#8)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Javier Cicchelli and mr-rock committed Apr 19, 2023
1 parent d8163ab commit 2ba3e33
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Sources/Communications/Classes/MockURLProtocol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class MockURLProtocol: URLProtocol {

// MARK: Properties

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

// MARK: Functions
Expand Down Expand Up @@ -75,8 +76,22 @@ public class MockURLProtocol: URLProtocol {

/// This model includes the data to be injected into an specific URL at the time of mocking its request.
public struct MockURLRequest: Hashable {

// MARK: Properties

public let method: HTTPRequestMethod
public let url: URL

// MARK: Initialisers

public init(
method: HTTPRequestMethod,
url: URL
) {
self.method = method
self.url = url
}

}

/// This model includes the data to be injected into an specific URL at the time of mocking its response.
Expand Down
10 changes: 10 additions & 0 deletions Sources/Core/Extensions/TimeZone+Zone.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import Foundation

public extension TimeZone {

// MARK: Zones

/// Greenwich Mean Time or UTC+0
static let gmt = TimeZone(secondsFromGMT: 0)

}

0 comments on commit 2ba3e33

Please sign in to comment.