func testGeneralServerResponse()

in FBSDKCoreKit/FBSDKCoreKitTests/Internal/AppEvents/Integrity/RestrictiveDataTests.swift [29:81]


  func testGeneralServerResponse() {
    let serverResponse = [
      testEvent1.rawValue: [
        "restrictive_param": restrictiveParam1,
        "deprecated_param": deprecatedParam1,
        "is_deprecated_event": true,
      ],
      testEvent2.rawValue: [
        "restrictive_param": restrictiveParam2,
        "deprecated_param": deprecatedParam2,
        "is_deprecated_event": false,
      ],
    ]

    let restrictiveData = createRestrictiveData(
      events: events,
      response: serverResponse
    )
    XCTAssertEqual(2, restrictiveData.count, "Unexpected count")

    let eventData1 = restrictiveData[0]
    XCTAssertEqual(AppEvents.Name("test_event_name_1"), eventData1.eventName)
    XCTAssertEqual(
      restrictiveParam1,
      eventData1.restrictiveParams,
      "The FBSDKRestrictiveData's eventName property should be equal to the actual event name."
    )
    XCTAssertEqual(
      deprecatedParam1,
      eventData1.deprecatedParams,
      "The FBSDKRestrictiveData's deprecatedParams property should be equal to the actual deprecated_param field."
    )
    XCTAssertTrue(
      eventData1.deprecatedEvent,
      "The FBSDKRestrictiveData's deprecatedEvent property should be equal to the actual is_deprecated_event field."
    )
    let eventData2 = restrictiveData[1]
    XCTAssertEqual(AppEvents.Name("test_event_name_2"), eventData2.eventName)
    XCTAssertEqual(
      restrictiveParam2,
      eventData2.restrictiveParams,
      "The FBSDKRestrictiveData's eventName property should be equal to the actual event name."
    )
    XCTAssertEqual(
      deprecatedParam2,
      eventData2.deprecatedParams,
      "The FBSDKRestrictiveData's deprecatedParams property should be equal to the actual deprecated_param field."
    )
    XCTAssertFalse(
      eventData2.deprecatedEvent,
      "The FBSDKRestrictiveData's deprecatedEvent property should be equal to the actual is_deprecated_event field."
    )
  }