@@ -170,99 +170,6 @@ - (void) testEvent {
170170 [serverInterfaceMock stopMocking ];
171171}
172172
173- - (void ) testUserCompletedAction {
174- // Mock the result. Fix up the expectedParameters for simulator hardware --
175-
176- NSMutableDictionary *expectedRequest =
177- [self mutableDictionaryFromBundleJSONWithKey: @" V2EventJSON" ];
178- expectedRequest[@" branch_key" ] = Branch.branchKey ;
179- expectedRequest[@" user_data" ] = [[BNCDeviceInfo getInstance ] v2dictionary ];
180- expectedRequest[@" event_data" ] = nil ;
181- expectedRequest[@" custom_data" ] = nil ;
182- expectedRequest[@" customer_event_alias" ] = nil ;
183-
184- Branch *branch = [Branch getInstance: @" key_live_foo" ];
185- XCTestExpectation *expectation = [self expectationWithDescription: @" v2-event-user-action" ];
186- id serverInterfaceMock = OCMPartialMock (branch.serverInterface );
187-
188- OCMStub (
189- [serverInterfaceMock genericHTTPRequest: [OCMArg any ]
190- retryNumber: 0
191- callback: [OCMArg any ]
192- retryHandler: [OCMArg any ]]
193- ).andDo (^(NSInvocation *invocation) {
194-
195- __unsafe_unretained NSURLRequest *request = nil ;
196- [invocation getArgument: &request atIndex: 2 ];
197-
198- NSError *error = nil ;
199- NSString *url = request.URL .absoluteString ;
200- NSData *bodyData = request.HTTPBody ;
201- NSDictionary *parameters =
202- [NSJSONSerialization JSONObjectWithData: bodyData options: 0 error: &error];
203- XCTAssertNil (error);
204-
205- NSLog (@" 2" );
206- NSLog (@" URL: %@ ." , url);
207- NSLog (@" Body: %@ ." , parameters);
208-
209- if ([url containsString: @" branch.io/v2/event/standard" ]) {
210- XCTAssertEqualObjects (expectedRequest, parameters);
211- [expectation fulfill ];
212- } else {
213- XCTFail (@" URL is unexpected. %@ " , url);
214- }
215- });
216-
217- // Set up the Branch Univseral Object --
218-
219- BranchUniversalObject *buo = [BranchUniversalObject new ];
220- buo.canonicalIdentifier = @" item/12345" ;
221- buo.canonicalUrl = @" https://branch.io/deepviews" ;
222- buo.title = @" My Content Title" ;
223- buo.contentDescription = @" my_product_description1" ;
224- buo.imageUrl = @" https://test_img_url" ;
225- buo.keywords = @[ @" My_Keyword1" , @" My_Keyword2" ];
226- buo.creationDate = [NSDate dateWithTimeIntervalSince1970: 1501869445321.0 /1000.0 ];
227- buo.expirationDate = [NSDate dateWithTimeIntervalSince1970: 212123232544.0 /1000.0 ];
228- buo.locallyIndex = YES ;
229- buo.publiclyIndex = NO ;
230-
231- buo.contentMetadata .contentSchema = BranchContentSchemaCommerceProduct;
232- buo.contentMetadata .quantity = 2 ;
233- buo.contentMetadata .price = [NSDecimalNumber decimalNumberWithString: @" 23.2" ];
234- buo.contentMetadata .currency = BNCCurrencyUSD;
235- buo.contentMetadata .sku = @" 1994320302" ;
236- buo.contentMetadata .productName = @" my_product_name1" ;
237- buo.contentMetadata .productBrand = @" my_prod_Brand1" ;
238- buo.contentMetadata .productCategory = BNCProductCategoryBabyToddler;
239- buo.contentMetadata .productVariant = @" 3T" ;
240- buo.contentMetadata .condition = @" FAIR" ;
241- buo.contentMetadata .ratingAverage = 5 ;
242- buo.contentMetadata .ratingCount = 5 ;
243- buo.contentMetadata .ratingMax = 7 ;
244- buo.contentMetadata .rating = 6 ;
245- buo.contentMetadata .addressStreet = @" Street_name1" ;
246- buo.contentMetadata .addressCity = @" city1" ;
247- buo.contentMetadata .addressRegion = @" Region1" ;
248- buo.contentMetadata .addressCountry = @" Country1" ;
249- buo.contentMetadata .addressPostalCode = @" postal_code" ;
250- buo.contentMetadata .latitude = 12.07 ;
251- buo.contentMetadata .longitude = -97.5 ;
252- buo.contentMetadata .imageCaptions = (id ) @[@" my_img_caption1" , @" my_img_caption_2" ];
253- buo.contentMetadata .customMetadata = (NSMutableDictionary *) @{
254- @" Custom_Content_metadata_key1" : @" Custom_Content_metadata_val1" ,
255- @" Custom_Content_metadata_key2" : @" Custom_Content_metadata_val2"
256- };
257-
258- // Set up and invoke --
259- [branch clearNetworkQueue ];
260- [buo userCompletedAction: @" PURCHASE" ];
261-
262- [self waitForExpectationsWithTimeout: 5.0 handler: nil ];
263- [serverInterfaceMock stopMocking ];
264- }
265-
266173- (void ) testExampleSyntax {
267174 BranchUniversalObject *contentItem = [BranchUniversalObject new ];
268175 contentItem.canonicalIdentifier = @" item/123" ;
0 commit comments