From 306505171027b631650b58ecd4ae5a1a6fd4a374 Mon Sep 17 00:00:00 2001 From: Enrico Zannini Date: Tue, 21 Feb 2023 12:21:42 +0100 Subject: [PATCH] Remove old test file --- Tests/BrazeInstanceJSONTests.swift | 593 ----------------------------- 1 file changed, 593 deletions(-) delete mode 100644 Tests/BrazeInstanceJSONTests.swift diff --git a/Tests/BrazeInstanceJSONTests.swift b/Tests/BrazeInstanceJSONTests.swift deleted file mode 100644 index d3fac0a..0000000 --- a/Tests/BrazeInstanceJSONTests.swift +++ /dev/null @@ -1,593 +0,0 @@ -// -// BrazeInstanceJSONTests.swift -// TealiumBrazeTests -// -// Created by Christina S on 9/24/20. -// Copyright © 2020 Tealium. All rights reserved. -// - -import XCTest -@testable import TealiumBraze -import BrazeKit -#if COCOAPODS -#else - import TealiumRemoteCommands -#endif - -class BrazeInstanceJSONTests: XCTestCase { - - let brazeInstance = MockBrazeInstance() - var brazeCommand: BrazeRemoteCommand! - - override func setUp() { - brazeCommand = BrazeRemoteCommand(brazeInstance: brazeInstance) - } - - override func tearDown() { - - } - - func testInitializeIsNotCalledWithoutApiKey() { - let expect = expectation(description: "test initialize called without api key") - let payload = ["command_name": "initialize"] - if let response = HttpTestHelpers.createRemoteCommandResponse(type: .JSON, commandId: "braze", payload: payload) { - brazeCommand.completion(response) - expect.fulfill() - XCTAssertEqual(0, brazeInstance.initializeBrazeCallCount) - } - wait(for: [expect], timeout: 2.0) - } - - // HERE - func testInitializeCalledWithApiKey() { - let expect = expectation(description: "test initialize called with api key") - let payload = ["command_name": "initialize", "api_key": "test123", "custom_endpoint": "testEndpoint"] - if let response = HttpTestHelpers.createRemoteCommandResponse(type: .JSON, commandId: "braze", payload: payload) { - brazeCommand.completion(response) - expect.fulfill() - XCTAssertEqual(1, brazeInstance.initializeBrazeCallCount) - } - wait(for: [expect], timeout: 2.0) - } - - func testInitializeWithBrazeConfig() { - let expect = expectation(description: "test initialize with appboy options") - let payload: [String: Any] = [ - "command_name": "initialize", - "api_key": "abc123", - "custom_endpoint": "test_endpoint", - "enable_automatic_location": "true", - "enable_geofences": "true", - "enable_automatic_geofences": "true", - "trigger_interval_seconds": 5.0, - "flush_interval": 12.0, - "request_processing_policy": "manual", - "device_options": ["carrier", "locale", "model"], - "push_story_identifier": "test.push.story.id", - ] - if let response = HttpTestHelpers.createRemoteCommandResponse(type: .JSON, commandId: "braze", payload: payload) { - brazeCommand.completion(response) - expect.fulfill() - let config = brazeInstance.config - XCTAssertNotNil(config) - XCTAssertEqual(config!.api.key, (payload["api_key"] as! String)) - XCTAssertEqual(config!.api.endpoint, (payload["custom_endpoint"] as! String)) - XCTAssertEqual(config!.api.flushInterval, payload["flush_interval"] as! Double) - XCTAssertEqual(config!.api.requestPolicy, Braze.Configuration.Api.RequestPolicy.from((payload["request_processing_policy"] as! String))) - XCTAssertEqual(config!.devicePropertyAllowList, Set((payload["device_options"] as! [String]).compactMap(Braze.Configuration.DeviceProperty.from(_:)))) - XCTAssertEqual(config!.push.appGroup, (payload["push_story_identifier"] as! String)) - XCTAssertEqual(config!.triggerMinimumTimeInterval, payload["trigger_interval_seconds"] as! Double) - XCTAssertEqual("\(config!.location.geofencesEnabled)", payload["enable_geofences"] as! String) - XCTAssertEqual("\(config!.location.automaticGeofenceRequests)", payload["enable_automatic_geofences"] as! String) - XCTAssertEqual("\(config!.location.automaticLocationCollection)", (payload["enable_automatic_location"] as! String)) - } - wait(for: [expect], timeout: 2.0) - } - - func testChangeUserIdentifierCalledSuccess() { - let expect = expectation(description: "test change user identifier called success") - let userIdentifier = "tealium-ios-test-user" - let payload = ["command_name": "initialize,useridentifier", "user_id": userIdentifier] - if let response = HttpTestHelpers.createRemoteCommandResponse(type: .JSON, commandId: "braze", payload: payload) { - brazeCommand.completion(response) - expect.fulfill() - XCTAssertEqual(1, brazeInstance.changeUserCallCount) - } - wait(for: [expect], timeout: 2.0) - } - - func testSetLastKnownLocationWithAltitudeAndVerticalAccuracy() { - let expect = expectation(description: "test last known location with altitude and vertical accuracy") - let payload: [String: Any] = [ - "command_name": "setlastknownlocation", - "disable_locaiton": "false", "location_longitude": 123.123, "location_latitude": 12.123, "location_horizontal_accuracy": 12.0, - "location_altitude": 12.0, - "location_vertical_accuracy": 12.0 - ] - if let response = HttpTestHelpers.createRemoteCommandResponse(type: .JSON, commandId: "braze", payload: payload) { - brazeCommand.completion(response) - expect.fulfill() - XCTAssertEqual(1, brazeInstance.setLastKnownLocationWithAltitudeVerticalAccuracyCallCount) - } - wait(for: [expect], timeout: 2.0) - } - - func testSetLastKnownLocationNoAltitudeAndVerticalAccuracy() { - let expect = expectation(description: "test last known location without altitude and vertical accuracy") - let payload: [String: Any] = [ - "command_name": "setlastknownlocation", - "disable_locaiton": "false", "location_longitude": 123.123, "location_latitude": 12.123, "location_horizontal_accuracy": 12.0 - ] - if let response = HttpTestHelpers.createRemoteCommandResponse(type: .JSON, commandId: "braze", payload: payload) { - brazeCommand.completion(response) - expect.fulfill() - XCTAssertEqual(1, brazeInstance.setLastKnownLocationNoAltitudeVerticalAccuracyCallCount) - } - wait(for: [expect], timeout: 5.0) - } - - func testChangeUserIdentifierNotCalled_userIdentifierKeyMissing() { - let expect = expectation(description: "test user identifier") - let payload = ["command_name": "initialize,useridentifier"] - if let response = HttpTestHelpers.createRemoteCommandResponse(type: .JSON, commandId: "braze", payload: payload) { - brazeCommand.completion(response) - expect.fulfill() - XCTAssertEqual(0, brazeInstance.changeUserCallCount) - } - wait(for: [expect], timeout: 2.0) - } - - func testUserAliasNotCalled_keysMissing() { - let expect = expectation(description: "test user alias not called") - let payload: [String: Any] = ["command_name": "initialize,useralias", - "user_alias": "test_alias" - ] - if let response = HttpTestHelpers.createRemoteCommandResponse(type: .JSON, commandId: "braze", payload: payload) { - brazeCommand.completion(response) - expect.fulfill() - XCTAssertEqual(0, brazeInstance.addAliasCallCount) - } - wait(for: [expect], timeout: 2.0) - } - - func testUserAliasNotCalledSuccess() { - let expect = expectation(description: "test user alias called") - let payload: [String: Any] = ["command_name": "initialize,useralias", - "user_alias": "test_alias", - "alias_label": "alias_label" - ] - if let response = HttpTestHelpers.createRemoteCommandResponse(type: .JSON, commandId: "braze", payload: payload) { - brazeCommand.completion(response) - expect.fulfill() - XCTAssertEqual(1, brazeInstance.addAliasCallCount) - } - wait(for: [expect], timeout: 2.0) - } - - func testLogCustomEventSuccess() { - let expect = expectation(description: "test log event success") - let payload = ["command_name": "initialize,lOGcustomEvent","event_name": "test_event"] - if let response = HttpTestHelpers.createRemoteCommandResponse(type: .JSON, commandId: "braze", payload: payload) { - brazeCommand.completion(response) - expect.fulfill() - XCTAssertEqual(1, brazeInstance.logCustomEventCallCount) - } - wait(for: [expect], timeout: 2.0) - } - - func testLogCustomEventNotCalled_logCustomEventNameMissing() { - let expect = expectation(description: "test log event with event name missing") - let payload = ["command_name": "initialize,lOGcustomEvent"] - if let response = HttpTestHelpers.createRemoteCommandResponse(type: .JSON, commandId: "braze", payload: payload) { - brazeCommand.completion(response) - expect.fulfill() - XCTAssertEqual(0, brazeInstance.logCustomEventCallCount) - } - wait(for: [expect], timeout: 2.0) - } - - func testLogCustomEventSuccess_propertiesMissing() { - let expect = expectation(description: "test log event without properties") - let payload: [String: Any] = ["command_name": "initialize,lOGcustomEvent", - "event_name": "test_event", - "properties_key_misnamed": [ - "key1": "value1", - "key2": "value2", - "key3": "value3"]] - if let response = HttpTestHelpers.createRemoteCommandResponse(type: .JSON, commandId: "braze", payload: payload) { - brazeCommand.completion(response) - expect.fulfill() - XCTAssertEqual(1, brazeInstance.logCustomEventCallCount) - XCTAssertEqual(0, brazeInstance.logCustomEventWithPropertiesCallCount) - } - wait(for: [expect], timeout: 2.0) - } - - func testLogCustomEventWithProperties() { - let expect = expectation(description: "test log event with properties") - let payload: [String: Any] = ["command_name": "initialize,lOGcustomEvent", - "event_name": "test_event", - "event_properties": [ - "key1": "value1", - "key2": "value2", - "key3": "value3"]] - if let response = HttpTestHelpers.createRemoteCommandResponse(type: .JSON, commandId: "braze", payload: payload) { - brazeCommand.completion(response) - expect.fulfill() - XCTAssertEqual(0, brazeInstance.logCustomEventCallCount) - XCTAssertEqual(1, brazeInstance.logCustomEventWithPropertiesCallCount) - } - wait(for: [expect], timeout: 2.0) - } - - func testUserAttributesSet() { - let expect = expectation(description: "test user attribute set") - let dateString = Date().iso8601String - let payload = [ - "command_name": "initialize,useridentifier,userAttribute", - "first_name": "first_name_test", - "last_name": "last_name_test", - "email": "email_test", - "date_of_birth": "\(dateString)", - "country": "country_test", - "language": "language_test", - "home_city": "home_city_test", - "phone": "phone_test", - "gender": "male"] - if let response = HttpTestHelpers.createRemoteCommandResponse(type: .JSON, commandId: "braze", payload: payload) { - brazeCommand.completion(response) - expect.fulfill() - XCTAssertEqual(9, brazeInstance.setUserAttributeCallCount) - } - wait(for: [expect], timeout: 2.0) - } - - func testUserAttributesSetOnlyCallsAppboyUserAttributeKeys() { - let expect = expectation(description: "test user attribute set") - let payload = [ - "command_name": "initialize,useridentifier,userAttribute", - "first_name": "first_name_test", - "last_name": "last_name_test", - "email": "email_test", - "country": "country_test", - "language": "language_test", - "home_city": "home_city_test", - "phone": "phone_test", - "not_a_user_attribute_key": "123", - "not_a_user_attribute_key2": "456" - ] - if let response = HttpTestHelpers.createRemoteCommandResponse(type: .JSON, commandId: "braze", payload: payload) { - brazeCommand.completion(response) - expect.fulfill() - XCTAssertEqual(7, brazeInstance.setUserAttributeCallCount) - } - wait(for: [expect], timeout: 2.0) - } - - func testCustomAttributesSet() { - let expect = expectation(description: "test custom attribute set") - let payload: [String: Any] = ["command_name": "initialize,setcustomattribute", - "set_custom_attribute": [ - "boolkey": false, - "intkey": 1, - "doublekey": 2.0, - "stringkey": "test_string"] - ] - if let response = HttpTestHelpers.createRemoteCommandResponse(type: .JSON, commandId: "braze", payload: payload) { - brazeCommand.completion(response) - expect.fulfill() - XCTAssertEqual(4, brazeInstance.setCustomAttributeWithKeyCallCount) - } - wait(for: [expect], timeout: 2.0) - } - - func testCustomAttributesNotCalled_keyMissing() { - let expect = expectation(description: "test custom attribute set") - let payload: [String: Any] = ["command_name": "initialize,setcustomattribute", - "boolkey": false, - "intkey": 1, - "doublekey": 2.0, - "stringkey": "test_string" - ] - if let response = HttpTestHelpers.createRemoteCommandResponse(type: .JSON, commandId: "braze", payload: payload) { - brazeCommand.completion(response) - expect.fulfill() - XCTAssertEqual(0, brazeInstance.setCustomAttributeWithKeyCallCount) - } - wait(for: [expect], timeout: 2.0) - } - - func testUnsetCustomAttributesNotCalled_keyMissing() { - let expect = expectation(description: "test custom attribute unset") - let payload: [String: Any] = ["command_name": "initialize,unsetcustomattribute" - ] - if let response = HttpTestHelpers.createRemoteCommandResponse(type: .JSON, commandId: "braze", payload: payload) { - brazeCommand.completion(response) - expect.fulfill() - XCTAssertEqual(0, brazeInstance.setCustomAttributeWithKeyCallCount) - } - wait(for: [expect], timeout: 2.0) - } - - func testUnsetCustomAttributesNotCalledSuccess() { - let expect = expectation(description: "test custom attribute unset") - let payload: [String: Any] = ["command_name": "initialize,unsetcustomattribute", - "unset_custom_attribute": "attribute_key" - ] - if let response = HttpTestHelpers.createRemoteCommandResponse(type: .JSON, commandId: "braze", payload: payload) { - brazeCommand.completion(response) - expect.fulfill() - XCTAssertEqual(0, brazeInstance.setCustomAttributeWithKeyCallCount) - } - wait(for: [expect], timeout: 2.0) - } - - func testIncrementCustomAttributeSuccess() { - let expect = expectation(description: "test increment custom attribute") - let payload: [String: Any] = ["command_name": "initialize,incrementcustomattribute", - "increment_custom_attribute": ["key1": 1, - "key2": 2] - ] - if let response = HttpTestHelpers.createRemoteCommandResponse(type: .JSON, commandId: "braze", payload: payload) { - brazeCommand.completion(response) - expect.fulfill() - XCTAssertEqual(2, brazeInstance.incrementCustomUserAttributeCallCount) - } - wait(for: [expect], timeout: 2.0) - } - - func testCustomArrayAttributeSet() { - let expect = expectation(description: "test custom array attribute set") - let payload: [String: Any] = ["command_name": "initialize,setcustomarrayattribute", - "set_custom_array_attribute": [ - "array_key1": ["value1", "value2", "value3"], - "array_key2": ["value1", "value2", "value3"], - "array_key3": ["value1", "value2", "value3"], - ] - ] - if let response = HttpTestHelpers.createRemoteCommandResponse(type: .JSON, commandId: "braze", payload: payload) { - brazeCommand.completion(response) - expect.fulfill() - XCTAssertEqual(3, brazeInstance.setCustomAttributeWithKeyCallCount) - } - wait(for: [expect], timeout: 2.0) - } - - func testAddToCustomAttributeArraySuccess() { - let expect = expectation(description: "test add to custom array attribute") - let payload: [String: Any] = ["command_name": "initialize,appendcustomarrayattribute", - "append_custom_array_attribute": [ - "array_key1": "value1", - "array_key2": "value2", - "array_key3": "value3" - ] - ] - if let response = HttpTestHelpers.createRemoteCommandResponse(type: .JSON, commandId: "braze", payload: payload) { - brazeCommand.completion(response) - expect.fulfill() - XCTAssertEqual(3, brazeInstance.addToCustomAttributeArrayWithKeyCallCount) - } - wait(for: [expect], timeout: 2.0) - } - - func testRemoveCustomAttributeArraySuccess() { - let expect = expectation(description: "test remove custom array attribute") - let payload: [String: Any] = ["command_name": "initialize,removecustomarrayattribute", - "remove_custom_array_attribute": [ - "array_key1": "value1", - "array_key2": "value2", - "array_key3": "value3" - ] - ] - if let response = HttpTestHelpers.createRemoteCommandResponse(type: .JSON, commandId: "braze", payload: payload) { - brazeCommand.completion(response) - expect.fulfill() - XCTAssertEqual(3, brazeInstance.removeFromCustomAttributeArrayWithKeyCallCount) - } - wait(for: [expect], timeout: 2.0) - } - - func testSetEmailNotificationSubscriptionTypeSuccess() { - let expect = expectation(description: "test set email notification subscription type") - let payload: [String: Any] = ["command_name": "initialize,emailnotification", - "email_notification": "optedIn" - ] - if let response = HttpTestHelpers.createRemoteCommandResponse(type: .JSON, commandId: "braze", payload: payload) { - brazeCommand.completion(response) - expect.fulfill() - XCTAssertEqual(1, brazeInstance.setEmailNotificationSubscriptionTypeCallCount) - } - wait(for: [expect], timeout: 2.0) - } - - func testSetEmailNotificationSubscriptionTypeNotCalled_incorrectSubscriptionType() { - let expect = expectation(description: "test set email notification subscription type") - let payload: [String: Any] = ["command_name": "initialize,emailnotification", - "email_notification": "UN subscribed" - ] - if let response = HttpTestHelpers.createRemoteCommandResponse(type: .JSON, commandId: "braze", payload: payload) { - brazeCommand.completion(response) - expect.fulfill() - XCTAssertEqual(0, brazeInstance.setEmailNotificationSubscriptionTypeCallCount) - } - wait(for: [expect], timeout: 2.0) - } - - func testSetPushNotificationSubscriptionTypeSuccess() { - let expect = expectation(description: "test set push notification subscription type") - let payload: [String: Any] = ["command_name": "initialize,pushnotification", - "push_notification": "subscribed" - ] - if let response = HttpTestHelpers.createRemoteCommandResponse(type: .JSON, commandId: "braze", payload: payload) { - brazeCommand.completion(response) - expect.fulfill() - XCTAssertEqual(1, brazeInstance.setPushNotificationSubscriptionTypeCallCount) - } - wait(for: [expect], timeout: 2.0) - } - - func testSetPushNotificationSubscriptionTypeNotCalled_incorrectSubscriptionType() { - let expect = expectation(description: "test set push notification subscription type") - let payload: [String: Any] = ["command_name": "initialize,pushnotification", - "email_notification": "SUBscribed" - ] - if let response = HttpTestHelpers.createRemoteCommandResponse(type: .JSON, commandId: "braze", payload: payload) { - brazeCommand.completion(response) - expect.fulfill() - XCTAssertEqual(0, brazeInstance.setEmailNotificationSubscriptionTypeCallCount) - } - wait(for: [expect], timeout: 2.0) - } - - func testLogPurchaseNotCalled_productIdentifierMissing() { - let expect = expectation(description: "test log purchase") - let payload: [String: Any] = ["command_name": "initialize,logpurchase", - "order_currency": "USD", - "product_unit_price": 12.34 - ] - if let response = HttpTestHelpers.createRemoteCommandResponse(type: .JSON, commandId: "braze", payload: payload) { - brazeCommand.completion(response) - expect.fulfill() - XCTAssertEqual(0, brazeInstance.logPurchaseCallCount) - } - wait(for: [expect], timeout: 2.0) - } - - func testLogPurchaseNotCalled_currencyMissing() { - let expect = expectation(description: "test log purchase") - let payload: [String: Any] = ["command_name": "initialize,logpurchase", - "product_id": "123", - "product_unit_price": 12.34 - ] - if let response = HttpTestHelpers.createRemoteCommandResponse(type: .JSON, commandId: "braze", payload: payload) { - brazeCommand.completion(response) - expect.fulfill() - XCTAssertEqual(0, brazeInstance.logPurchaseCallCount) - } - wait(for: [expect], timeout: 2.0) - } - - func testLogPurchaseNotCalled_priceMissing() { - let expect = expectation(description: "test log purchase") - let payload: [String: Any] = ["command_name": "initialize,logpurchase", - "product_id": "123", - "order_currency": "USD" - ] - if let response = HttpTestHelpers.createRemoteCommandResponse(type: .JSON, commandId: "braze", payload: payload) { - brazeCommand.completion(response) - expect.fulfill() - XCTAssertEqual(0, brazeInstance.logPurchaseCallCount) - } - wait(for: [expect], timeout: 2.0) - } - - func testLogPurchaseSuccess() { - let expect = expectation(description: "test log purchase") - let payload: [String: Any] = ["command_name": "initialize,logpurchase", - "product_id": ["123"], - "order_currency": "USD", - "product_unit_price": [12.34] - ] - if let response = HttpTestHelpers.createRemoteCommandResponse(type: .JSON, commandId: "braze", payload: payload) { - brazeCommand.completion(response) - expect.fulfill() - XCTAssertEqual(1, brazeInstance.logPurchaseCallCount) - XCTAssertEqual(0, brazeInstance.logPurchaseWithQuantityCallCount) - XCTAssertEqual(0, brazeInstance.logPurchaseWithPropertiesCallCount) - XCTAssertEqual(0, brazeInstance.logPurchaseWithQuantityWithPropertiesCallCount) - } - wait(for: [expect], timeout: 2.0) - } - - func testLogPurchaseWithQuantitySuccess() { - let expect = expectation(description: "test log purchase") - let payload: [String: Any] = ["command_name": "initialize,logpurchase", - "product_id": ["123"], - "order_currency": "USD", - "product_unit_price": [12.34], - "quantity": [5] - ] - if let response = HttpTestHelpers.createRemoteCommandResponse(type: .JSON, commandId: "braze", payload: payload) { - brazeCommand.completion(response) - expect.fulfill() - XCTAssertEqual(0, brazeInstance.logPurchaseCallCount) - XCTAssertEqual(1, brazeInstance.logPurchaseWithQuantityCallCount) - XCTAssertEqual(0, brazeInstance.logPurchaseWithPropertiesCallCount) - XCTAssertEqual(0, brazeInstance.logPurchaseWithQuantityWithPropertiesCallCount) - } - wait(for: [expect], timeout: 2.0) - } - - func testLogPurchaseWithPropertiesSuccess() { - let expect = expectation(description: "test log purchase") - let payload: [String: Any] = ["command_name": "initialize,logpurchase", - "product_id": ["123"], - "order_currency": "USD", - "product_unit_price": [12.34], - "purchase_properties": ["item1": 123] - ] - if let response = HttpTestHelpers.createRemoteCommandResponse(type: .JSON, commandId: "braze", payload: payload) { - brazeCommand.completion(response) - expect.fulfill() - XCTAssertEqual(0, brazeInstance.logPurchaseCallCount) - XCTAssertEqual(0, brazeInstance.logPurchaseWithQuantityCallCount) - XCTAssertEqual(1, brazeInstance.logPurchaseWithPropertiesCallCount) - XCTAssertEqual(0, brazeInstance.logPurchaseWithQuantityWithPropertiesCallCount) - } - wait(for: [expect], timeout: 2.0) - } - - func testLogPurchaseWithPropertiesWithQuantitySuccess() { - let expect = expectation(description: "test log purchase") - let payload: [String: Any] = ["command_name": "initialize,logpurchase", - "product_id": ["123", "456"], - "order_currency": "USD", - "product_unit_price": [12.34, 1.99], - "quantity": [1, 2], - "purchase_properties": ["item1": 123] - ] - if let response = HttpTestHelpers.createRemoteCommandResponse(type: .JSON, commandId: "braze", payload: payload) { - brazeCommand.completion(response) - expect.fulfill() - XCTAssertEqual(0, brazeInstance.logPurchaseCallCount) - XCTAssertEqual(0, brazeInstance.logPurchaseWithQuantityCallCount) - XCTAssertEqual(0, brazeInstance.logPurchaseWithPropertiesCallCount) - XCTAssertEqual(1, brazeInstance.logPurchaseWithQuantityWithPropertiesCallCount) - } - wait(for: [expect], timeout: 2.0) - } - - func testDisableSDK() { - let expect = expectation(description: "sdk is disabled") - let payload: [String: Any] = ["command_name": "disablesdk"] - if let response = HttpTestHelpers.createRemoteCommandResponse(type: .JSON, commandId: "braze", payload: payload) { - brazeCommand.completion(response) - expect.fulfill() - XCTAssertEqual(1, brazeInstance.disableCallCount) - } - wait(for: [expect], timeout: 2.0) - } - - func testReenableSDK() { - let expect = expectation(description: "sdk is reenabled") - let payload: [String: Any] = ["command_name": "enablesdk"] - if let response = HttpTestHelpers.createRemoteCommandResponse(type: .JSON, commandId: "braze", payload: payload) { - brazeCommand.completion(response) - expect.fulfill() - XCTAssertEqual(1, brazeInstance.reEnableCallCount) - } - wait(for: [expect], timeout: 2.0) - } - - func testWipeData() { - let expect = expectation(description: "wipe data is called") - let payload: [String: Any] = ["command_name": "wipedata"] - if let response = HttpTestHelpers.createRemoteCommandResponse(type: .JSON, commandId: "braze", payload: payload) { - brazeCommand.completion(response) - expect.fulfill() - XCTAssertEqual(1, brazeInstance.wipeDataCallCount) - } - wait(for: [expect], timeout: 2.0) - } -} -