@@ -283,17 +283,15 @@ class ValidationTests: XCTestCase {
283283 func testClaimJustExpiredWithoutLeeway( ) {
284284 var claims = ClaimSet ( )
285285 claims. expiration = Date ( ) . addingTimeInterval ( - 1 )
286-
287- let expectation = XCTestExpectation ( description: " Signature should be expired. " )
286+
288287 do {
289288 try claims. validateExpiary ( )
290289 XCTFail ( " InvalidToken.expiredSignature error should have been thrown. " )
291290 } catch InvalidToken . expiredSignature {
292- expectation . fulfill ( )
291+ // Correct error thrown
293292 } catch {
294293 XCTFail ( " Unexpected error while validating exp claim. " )
295294 }
296- self . wait ( for: [ expectation] , timeout: 0.5 )
297295 }
298296
299297 func testClaimJustNotExpiredWithoutLeeway( ) {
@@ -311,16 +309,14 @@ class ValidationTests: XCTestCase {
311309 var claims = ClaimSet ( )
312310 claims. notBefore = Date ( ) . addingTimeInterval ( 1 )
313311
314- let expectation = XCTestExpectation ( description: " Signature should be immature. " )
315312 do {
316313 try claims. validateNotBefore ( )
317314 XCTFail ( " InvalidToken.immatureSignature error should have been thrown. " )
318315 } catch InvalidToken . immatureSignature {
319- expectation . fulfill ( )
316+ // Correct error thrown
320317 } catch {
321318 XCTFail ( " Unexpected error while validating nbf claim. " )
322319 }
323- self . wait ( for: [ expectation] , timeout: 0.5 )
324320 }
325321
326322 func testNotBeforeIsValidWithLeeway( ) {
@@ -337,17 +333,15 @@ class ValidationTests: XCTestCase {
337333 func testIssuedAtIsInFutureWithoutLeeway( ) {
338334 var claims = ClaimSet ( )
339335 claims. issuedAt = Date ( ) . addingTimeInterval ( 1 )
340-
341- let expectation = XCTestExpectation ( description: " iat should be in the future. " )
336+
342337 do {
343338 try claims. validateIssuedAt ( )
344339 XCTFail ( " InvalidToken.invalidIssuedAt error should have been thrown. " )
345340 } catch InvalidToken . invalidIssuedAt {
346- expectation . fulfill ( )
341+ // Correct error thrown
347342 } catch {
348343 XCTFail ( " Unexpected error while validating iat claim. " )
349344 }
350- self . wait ( for: [ expectation] , timeout: 0.5 )
351345 }
352346
353347 func testIssuedAtIsValidWithLeeway( ) {
@@ -371,17 +365,15 @@ class IntegrationTests: XCTestCase {
371365 builder. notBefore = Date ( ) . addingTimeInterval ( 1 ) // Token starts being valid in one second
372366 builder. issuedAt = Date ( ) . addingTimeInterval ( 1 ) // Token is issued one second in the future
373367 }
374-
375- let expectation = XCTestExpectation ( description: " Verification should fail. " )
368+
376369 do {
377370 let _ = try JWT . decode ( token, algorithm: . none, leeway: 0 )
378371 XCTFail ( " InvalidToken error should have been thrown. " )
379372 } catch is InvalidToken {
380- expectation . fulfill ( )
373+ // Correct error thrown
381374 } catch {
382375 XCTFail ( " Unexpected error type while verifying token. " )
383376 }
384- self . wait ( for: [ expectation] , timeout: 0.5 )
385377 }
386378
387379 func testVerificationSuccessWithLeeway( ) {
0 commit comments