func validateRefreshedToken()

in FBSDKCoreKit/FBSDKCoreKitTests/Internal/Network/GraphRequestPiggybackManagerTests.swift [847:915]


  func validateRefreshedToken(
    _ refreshedToken: AccessToken?,
    expectedTokenString: String = SampleAccessTokens.validToken.tokenString,
    expectedRefreshDate: Date = Date(),
    expectedExpirationDate: Date = Date.distantFuture,
    expectedDataExpirationDate: Date = Date.distantFuture,
    expectedPermissions: Set<Permission> = [],
    expectedDeclinedPermissions: Set<Permission> = [],
    expectedExpiredPermissions: Set<Permission> = [],
    file: StaticString = #file,
    line: UInt = #line
  ) throws {
    let token = try XCTUnwrap(
      refreshedToken,
      "Must have an access token to assert against",
      file: file,
      line: line
    )
    XCTAssertEqual(
      token.tokenString,
      expectedTokenString,
      "A refreshed token should have the expected token string",
      file: file,
      line: line
    )
    XCTAssertEqual(
      token.refreshDate.timeIntervalSince1970,
      expectedRefreshDate.timeIntervalSince1970,
      accuracy: 1,
      "A refreshed token should have the expected refresh date",
      file: file,
      line: line
    )
    XCTAssertEqual(
      token.expirationDate,
      expectedExpirationDate,
      "A refreshed token should have the expected expiration date",
      file: file,
      line: line
    )
    XCTAssertEqual(
      token.dataAccessExpirationDate,
      expectedDataExpirationDate,
      "A refreshed token should have the expected data access expiration date",
      file: file,
      line: line
    )
    XCTAssertEqual(
      token.permissions,
      expectedPermissions,
      "A refreshed token should have the expected permissions",
      file: file,
      line: line
    )
    XCTAssertEqual(
      token.declinedPermissions,
      expectedDeclinedPermissions,
      "A refreshed token should have the expected declined permissions",
      file: file,
      line: line
    )
    XCTAssertEqual(
      token.expiredPermissions,
      expectedExpiredPermissions,
      "A refreshed token should have the expected expired permissions",
      file: file,
      line: line
    )
  }