diff --git a/Package.resolved b/Package.resolved index fe715fb..fe248f5 100644 --- a/Package.resolved +++ b/Package.resolved @@ -1,13 +1,13 @@ { - "originHash" : "f5b6a4870c89f10d1a64f4ddeeccc767b0b38eca2482b4883a3f9ead13466e4b", + "originHash" : "b836221e34ec0f45fe905f2894101fdf79be95fd47c8af481a0b62425b316150", "pins" : [ { "identity" : "devtesting", "kind" : "remoteSourceControl", "location" : "https://github.com/DevKitOrganization/DevTesting", "state" : { - "revision" : "7dcd0757a4fa146ffeede688d649953643014be9", - "version" : "1.2.0" + "revision" : "b1e7ff0dd4b4f850fbbf886e192d91771ec1599d", + "version" : "1.3.0" } }, { diff --git a/Package.swift b/Package.swift index 92283d0..a342cde 100644 --- a/Package.swift +++ b/Package.swift @@ -32,7 +32,7 @@ let package = Package( dependencies: [ .package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.6.1"), .package(url: "https://github.com/apple/swift-numerics.git", from: "1.1.0"), - .package(url: "https://github.com/DevKitOrganization/DevTesting", from: "1.2.0"), + .package(url: "https://github.com/DevKitOrganization/DevTesting", from: "1.3.0"), .package(url: "https://github.com/prachigauriar/URLMock.git", from: "1.3.6"), ], targets: [ diff --git a/Sources/DevFoundation/Date Providers/DateProvider.swift b/Sources/DevFoundation/Date Providers/DateProvider.swift index 13258c7..cd0d8aa 100644 --- a/Sources/DevFoundation/Date Providers/DateProvider.swift +++ b/Sources/DevFoundation/Date Providers/DateProvider.swift @@ -13,8 +13,8 @@ import Foundation /// a static value or run fast or slow. /// /// To make effective use of `DateProvider`, you should never use Foundation APIs that implicitly use the current date, -/// e.g., `Date()` or `Date(timeIntervalSinceNow:)`. Instead, use `DateProviders.current.now` with APIs that take a -/// reference date, like `Date(timeInterval:since:)`. +/// e.g., `Date()` or `Date(timeIntervalSinceNow:)`. Instead, use a ``now`` with APIs that take a reference date, like +/// `Date(timeInterval:since:)`. public protocol DateProvider: Sendable { /// The current date, according to the date provider. var now: Date { get } diff --git a/Tests/DevFoundationTests/Networking/Web Service Client/JSONBodyWebServiceRequestTests.swift b/Tests/DevFoundationTests/Networking/Web Service Client/JSONBodyWebServiceRequestTests.swift index b633250..1148eb2 100644 --- a/Tests/DevFoundationTests/Networking/Web Service Client/JSONBodyWebServiceRequestTests.swift +++ b/Tests/DevFoundationTests/Networking/Web Service Client/JSONBodyWebServiceRequestTests.swift @@ -16,7 +16,7 @@ struct JSONBodyWebServiceRequestTests: RandomValueGenerating { @Test mutating func jsonEncoderReturnsUncustomizedJSONEncoder() throws { - let jsonBody = MockJSONBody(dataProperty: randomData(), dateProperty: Date(timeIntervalSinceReferenceDate: 0)) + let jsonBody = MockJSONBody(dataProperty: randomData(), dateProperty: randomDate()) let request = DefaultJSONBodyWebServiceRequest(jsonBody: jsonBody) let jsonEncoder = request.jsonEncoder @@ -37,7 +37,7 @@ struct JSONBodyWebServiceRequestTests: RandomValueGenerating { @Test mutating func httpBodyEncodesJSONBody() throws { - let jsonBody = MockJSONBody(dataProperty: randomData(), dateProperty: Date(timeIntervalSinceReferenceDate: 0)) + let jsonBody = MockJSONBody(dataProperty: randomData(), dateProperty: randomDate()) let jsonEncoder = JSONEncoder() jsonEncoder.outputFormatting = [.prettyPrinted, .sortedKeys] diff --git a/Tests/DevFoundationTests/Testing Helpers/RandomValueGenerating+DevFoundation.swift b/Tests/DevFoundationTests/Testing Helpers/RandomValueGenerating+DevFoundation.swift index 96343a2..07b7932 100644 --- a/Tests/DevFoundationTests/Testing Helpers/RandomValueGenerating+DevFoundation.swift +++ b/Tests/DevFoundationTests/Testing Helpers/RandomValueGenerating+DevFoundation.swift @@ -10,11 +10,6 @@ import DevTesting import Foundation extension RandomValueGenerating { - mutating func randomDate() -> Date { - return Date(timeIntervalSinceNow: random(TimeInterval.self, in: -10_000 ... 10_000)) - } - - mutating func randomDuration() -> Duration { return Duration( secondsComponent: random(Int64.self, in: 0 ... 10_000_000),