Skip to content

Commit 72becff

Browse files
committed
Treat coupons as expired when we reach expiry date
We have a test for `test_isExpired_when_current_date_then_returns_true`, however, we didn’t quite match that. We actually relied on a small amount of time elapsing between the call to create the POSCoupon with `Date.now` and the check for whether the coupon had expired. In some test runs, there was no measurable time change, so the test would fail. This fixes the implementation to match the test, and general understanding of an expiry time – when you reach the time, the coupon expires.
1 parent 2e05cde commit 72becff

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Modules/Sources/Yosemite/PointOfSale/Coupons/POSCoupon.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ public struct POSCoupon: Equatable, Hashable {
1717
guard let dateExpires = dateExpires else {
1818
return false
1919
}
20-
return dateExpires < Date()
20+
return dateExpires <= Date()
2121
}
2222
}

0 commit comments

Comments
 (0)