diff options
author | Joel Fischer <joeljfischer@gmail.com> | 2018-11-28 13:50:29 -0500 |
---|---|---|
committer | Joel Fischer <joeljfischer@gmail.com> | 2018-11-28 13:50:29 -0500 |
commit | 7684f22e05c0de4785c9dbba53af18db52ddad73 (patch) | |
tree | 5ad764a93c975ac5d89316122d3c9bd1677ba7ea | |
parent | 6c52a96f67fd68a3b0b153dfc4ab628a9984d839 (diff) | |
download | sdl_ios-7684f22e05c0de4785c9dbba53af18db52ddad73.tar.gz |
Add tests
-rw-r--r-- | SmartDeviceLinkTests/DevAPISpecs/SDLCheckChoiceVROptionalOperationSpec.m | 52 |
1 files changed, 36 insertions, 16 deletions
diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLCheckChoiceVROptionalOperationSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLCheckChoiceVROptionalOperationSpec.m index 2809c3871..2d8734f8f 100644 --- a/SmartDeviceLinkTests/DevAPISpecs/SDLCheckChoiceVROptionalOperationSpec.m +++ b/SmartDeviceLinkTests/DevAPISpecs/SDLCheckChoiceVROptionalOperationSpec.m @@ -6,6 +6,8 @@ #import "SDLChoice.h" #import "SDLCreateInteractionChoiceSet.h" #import "SDLCreateInteractionChoiceSetResponse.h" +#import "SDLDeleteInteractionChoiceSet.h" +#import "SDLDeleteInteractionChoiceSetResponse.h" #import "TestConnectionManager.h" QuickSpecBegin(SDLCheckChoiceVROptionalOperationSpec) @@ -64,15 +66,26 @@ describe(@"check choice VR optional operation", ^{ [testConnectionManager respondToLastRequestWithResponse:testResponse]; }); - it(@"should have called the completion handler with proper data", ^{ - expect(hasCalledOperationCompletionHandler).toEventually(beTrue()); - expect(resultVROptional).to(beTrue()); - expect(resultError).to(beNil()); + it(@"should have sent a DeleteChoiceSet request", ^{ + expect(testConnectionManager.receivedRequests.lastObject).to(beAnInstanceOf([SDLDeleteInteractionChoiceSet class])); }); - it(@"should be set to finished", ^{ - expect(@(testOp.finished)).to(equal(@YES)); - expect(@(testOp.executing)).to(equal(@NO)); + describe(@"after the DeleteChoiceSet response", ^{ + beforeEach(^{ + SDLDeleteInteractionChoiceSetResponse *testDeleteResponse = [[SDLDeleteInteractionChoiceSetResponse alloc] init]; + testDeleteResponse.success = @YES; + testDeleteResponse.resultCode = SDLResultSuccess; + + [testConnectionManager respondToLastRequestWithResponse:testDeleteResponse]; + }); + + it(@"should have called the completion handler with proper data and finish", ^{ + expect(hasCalledOperationCompletionHandler).toEventually(beTrue()); + expect(resultVROptional).to(beTrue()); + expect(resultError).to(beNil()); + expect(@(testOp.finished)).to(equal(@YES)); + expect(@(testOp.executing)).to(equal(@NO)); + }); }); }); @@ -109,15 +122,22 @@ describe(@"check choice VR optional operation", ^{ [testConnectionManager respondToLastRequestWithResponse:testResponse]; }); - it(@"should have called the completion handler with proper data", ^{ - expect(hasCalledOperationCompletionHandler).toEventually(beTrue()); - expect(resultVROptional).toEventually(beFalse()); - expect(resultError).toEventually(beNil()); - }); - - it(@"should be set to finished", ^{ - expect(@(testOp.finished)).to(equal(@YES)); - expect(@(testOp.executing)).to(equal(@NO)); + describe(@"after the DeleteChoiceSet response", ^{ + beforeEach(^{ + SDLDeleteInteractionChoiceSetResponse *testDeleteResponse = [[SDLDeleteInteractionChoiceSetResponse alloc] init]; + testDeleteResponse.success = @YES; + testDeleteResponse.resultCode = SDLResultSuccess; + + [testConnectionManager respondToLastRequestWithResponse:testDeleteResponse]; + }); + + it(@"should have called the completion handler with proper data and finish", ^{ + expect(hasCalledOperationCompletionHandler).toEventually(beTrue()); + expect(resultVROptional).to(beTrue()); + expect(resultError).to(beNil()); + expect(@(testOp.finished)).to(equal(@YES)); + expect(@(testOp.executing)).to(equal(@NO)); + }); }); }); |