Skip to content
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
6 changes: 3 additions & 3 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand Down
4 changes: 2 additions & 2 deletions Sources/DevFoundation/Date Providers/DateProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
Loading