@@ -57,7 +57,12 @@ class DecodeTests: XCTestCase {
57
57
let jwt = " eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MjgxODg0OTF9.EW7k-8Mvnv0GpvOKJalFRLoCB3a3xGG3i7hAZZXNAz0 "
58
58
59
59
let claims = try JWT . decode ( jwt, algorithm: . hs256( " secret " . data ( using: . utf8) !) )
60
- XCTAssertEqual ( claims. expiration? . timeIntervalSince1970, 1728188491 )
60
+
61
+ if let expirationClaim = claims. expiration? . timeIntervalSince1970 {
62
+ XCTAssertEqual ( Int ( expirationClaim) , 1728188491 )
63
+ } else {
64
+ XCTFail ( )
65
+ }
61
66
}
62
67
63
68
func testUnexpiredClaimString( ) throws {
@@ -74,7 +79,11 @@ class DecodeTests: XCTestCase {
74
79
let jwt = " eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE0MjgxODk3MjB9.jFT0nXAJvEwyG6R7CMJlzNJb7FtZGv30QRZpYam5cvs "
75
80
76
81
let claims = try JWT . decode ( jwt, algorithm: . hs256( " secret " . data ( using: . utf8) !) )
77
- XCTAssertEqual ( claims. notBefore? . timeIntervalSince1970, 1428189720 )
82
+ if let notBeforeClaim = claims. notBefore? . timeIntervalSince1970 {
83
+ XCTAssertEqual ( Int ( notBeforeClaim) , 1428189720 )
84
+ } else {
85
+ XCTFail ( )
86
+ }
78
87
}
79
88
80
89
func testNotBeforeClaimString( ) throws {
@@ -101,7 +110,11 @@ class DecodeTests: XCTestCase {
101
110
let jwt = " eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE0MjgxODk3MjB9.I_5qjRcCUZVQdABLwG82CSuu2relSdIyJOyvXWUAJh4 "
102
111
103
112
let claims = try JWT . decode ( jwt, algorithm: . hs256( " secret " . data ( using: . utf8) !) )
104
- XCTAssertEqual ( claims. issuedAt? . timeIntervalSince1970, 1428189720 )
113
+ if let issuedAtClaim = claims. issuedAt? . timeIntervalSince1970 {
114
+ XCTAssertEqual ( Int ( issuedAtClaim) , 1428189720 )
115
+ } else {
116
+ XCTFail ( )
117
+ }
105
118
}
106
119
107
120
func testIssuedAtClaimInThePastString( ) throws {
0 commit comments