func testHandlingRequestErrorWithImageContent()

in FBSDKGamingServicesKit/FBSDKGamingServicesKitTests/Internal/CustomUpdateGraphRequestTests.swift [222:241]


  func testHandlingRequestErrorWithImageContent() throws {
    var completionWasInvoked = false
    try requester.request(content: CustomUpdateContentObjects.imageContentValid) { result in
      switch result {
      case let .failure(error):
        guard case let .server(serverError) = error else {
          return XCTFail("Should not be a decoding error")
        }
        XCTAssertTrue(serverError is SampleError)
      case .success:
        XCTFail("Should not succeed")
      }
      completionWasInvoked = true
    }
    let completion = try XCTUnwrap(factory.capturedRequests.first?.capturedCompletionHandler)

    completion(nil, nil, SampleError())

    XCTAssert(completionWasInvoked)
  }