@@ -4,6 +4,16 @@ import Testing
44
55@MainActor
66struct AppStateTests {
7+ static let recentDateString : String = {
8+ let formatter = ISO8601DateFormatter ( )
9+ return formatter. string ( from: Date ( ) . addingTimeInterval ( - 2 * 24 * 60 * 60 ) )
10+ } ( )
11+
12+ static let recentUpdatedDateString : String = {
13+ let formatter = ISO8601DateFormatter ( )
14+ return formatter. string ( from: Date ( ) . addingTimeInterval ( - 1 * 24 * 60 * 60 ) )
15+ } ( )
16+
717 static func makeNotification( id: Int , repo: String = " acme/alpha " , isUnread: Bool = true ) -> GitHubNotification {
818 GitHubNotification (
919 id: " \( id) " ,
@@ -98,7 +108,7 @@ struct AppStateTests {
98108 static func singleNotificationPayload(
99109 id: String ,
100110 isUnread: Bool = true ,
101- updatedAt: String = " 2026-04-01T12:00:00Z " ,
111+ updatedAt: String = recentDateString ,
102112 subjectURL: String ? = nil
103113 ) -> Data {
104114 let subjectURLField : String
@@ -129,7 +139,7 @@ struct AppStateTests {
129139 """ . data ( using: . utf8) !
130140 }
131141
132- static func notificationsPayload( ids: [ String ] , updatedAt: String = " 2026-04-01T12:00:00Z " ) -> Data {
142+ static func notificationsPayload( ids: [ String ] , updatedAt: String = recentDateString ) -> Data {
133143 let items = ids. map { id in
134144 """
135145 {
@@ -153,7 +163,7 @@ struct AppStateTests {
153163 return " [ \n \( items) \n ] " . data ( using: . utf8) !
154164 }
155165
156- static func dependabotAlertsPayload( updatedAt: String = " 2026-04-01T12:00:00Z " ) -> Data {
166+ static func dependabotAlertsPayload( updatedAt: String = recentDateString ) -> Data {
157167 """
158168 [
159169 {
@@ -465,7 +475,7 @@ struct AppStateTests {
465475 )
466476 ) ) ,
467477 . success( (
468- Self . dependabotAlertsPayload ( updatedAt : " 2026-04-01T12:00:00Z " ) ,
478+ Self . dependabotAlertsPayload ( ) ,
469479 Self . httpResponse (
470480 url: " https://api.github.com/repos/acme/alpha/dependabot/alerts " ,
471481 statusCode: 200
@@ -487,7 +497,7 @@ struct AppStateTests {
487497 )
488498 ) ) ,
489499 . success( (
490- Self . dependabotAlertsPayload ( updatedAt : " 2026-04-01T12:00:00Z " ) ,
500+ Self . dependabotAlertsPayload ( ) ,
491501 Self . httpResponse (
492502 url: " https://api.github.com/repos/acme/alpha/dependabot/alerts " ,
493503 statusCode: 200
@@ -509,7 +519,7 @@ struct AppStateTests {
509519 )
510520 ) ) ,
511521 . success( (
512- Self . dependabotAlertsPayload ( updatedAt: " 2026-04-02T12:00:00Z " ) ,
522+ Self . dependabotAlertsPayload ( updatedAt: Self . recentUpdatedDateString ) ,
513523 Self . httpResponse (
514524 url: " https://api.github.com/repos/acme/alpha/dependabot/alerts " ,
515525 statusCode: 200
@@ -576,7 +586,7 @@ struct AppStateTests {
576586 )
577587 ) ) ,
578588 . success( (
579- Self . dependabotAlertsPayload ( updatedAt : " 2026-04-01T12:00:00Z " ) ,
589+ Self . dependabotAlertsPayload ( ) ,
580590 Self . httpResponse (
581591 url: " https://api.github.com/repos/acme/alpha/dependabot/alerts " ,
582592 statusCode: 200
@@ -628,7 +638,7 @@ struct AppStateTests {
628638 )
629639 ) ) ,
630640 . success( (
631- Self . dependabotAlertsPayload ( updatedAt : " 2026-04-01T12:00:00Z " ) ,
641+ Self . dependabotAlertsPayload ( ) ,
632642 Self . httpResponse (
633643 url: " https://api.github.com/repos/acme/alpha/dependabot/alerts " ,
634644 statusCode: 200
@@ -650,7 +660,7 @@ struct AppStateTests {
650660 )
651661 ) ) ,
652662 . success( (
653- Self . dependabotAlertsPayload ( updatedAt : " 2026-04-01T12:00:00Z " ) ,
663+ Self . dependabotAlertsPayload ( ) ,
654664 Self . httpResponse (
655665 url: " https://api.github.com/repos/acme/alpha/dependabot/alerts " ,
656666 statusCode: 200
0 commit comments