File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -133,7 +133,8 @@ class TestJWT: XCTestCase {
133133 ( " testMicroProfile " , testMicroProfile) ,
134134 ( " testValidateClaims " , testValidateClaims) ,
135135 ( " testValidateClaimsLeeway " , testValidateClaimsLeeway) ,
136- ]
136+ ( " testErrorPattenMatching " , testErrorPattenMatching) ,
137+ ]
137138 }
138139
139140 func testSignAndVerify( ) {
@@ -539,6 +540,16 @@ class TestJWT: XCTestCase {
539540 jwt. claims. nbf = Date ( timeIntervalSinceNow: 10 )
540541 XCTAssertEqual ( jwt. validateClaims ( leeway: 20 ) , . success, " Validation failed " )
541542 }
543+
544+ func testErrorPattenMatching( ) {
545+ do {
546+ let _ = try JWT < TestClaims > ( jwtString: " InvalidString " , verifier: . rs256( publicKey: rsaPublicKey) )
547+ } catch JWTError . invalidJWTString {
548+ // Caught correct error
549+ } catch {
550+ XCTFail ( " Incorrect error thrown: \( error) " )
551+ }
552+ }
542553}
543554
544555func read( fileName: String ) -> Data {
You can’t perform that action at this time.
0 commit comments