summaryrefslogtreecommitdiff
path: root/SmartDeviceLinkTests
diff options
context:
space:
mode:
authorJoel Fischer <joeljfischer@gmail.com>2016-07-20 09:27:38 -0400
committerJoel Fischer <joeljfischer@gmail.com>2016-07-20 09:27:38 -0400
commit662a78eea16078e5d978ab788c8b2439d1a77d4b (patch)
tree6ff84779398118a0c8e71b6be427c5a147208e7a /SmartDeviceLinkTests
parent80d17248936461e8c8e55bad7791f876c4c188a8 (diff)
downloadsdl_ios-662a78eea16078e5d978ab788c8b2439d1a77d4b.tar.gz
Fix a few warnings related to passing null to nonnull parameters
* Add additional tests
Diffstat (limited to 'SmartDeviceLinkTests')
-rw-r--r--SmartDeviceLinkTests/DevAPISpecs/SDLConfigurationSpec.m2
-rw-r--r--SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleManagerSpec.m34
2 files changed, 34 insertions, 2 deletions
diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLConfigurationSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLConfigurationSpec.m
index 618764622..02e9c8ba0 100644
--- a/SmartDeviceLinkTests/DevAPISpecs/SDLConfigurationSpec.m
+++ b/SmartDeviceLinkTests/DevAPISpecs/SDLConfigurationSpec.m
@@ -20,7 +20,7 @@ describe(@"a configuration", ^{
someAppId = @"some id";
someLifecycleConfig = [SDLLifecycleConfiguration defaultConfigurationWithAppName:someAppName appId:someAppId];
- testConfig = [SDLConfiguration configurationWithLifecycle:someLifecycleConfig lockScreen:nil];
+ testConfig = [SDLConfiguration configurationWithLifecycle:someLifecycleConfig lockScreen:[SDLLockScreenConfiguration enabledConfiguration]];
});
it(@"should contain the correct configs", ^{
diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleManagerSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleManagerSpec.m
index 565475cb7..bbfdf2b6a 100644
--- a/SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleManagerSpec.m
+++ b/SmartDeviceLinkTests/DevAPISpecs/SDLLifecycleManagerSpec.m
@@ -5,11 +5,16 @@
#import "SDLLifecycleManager.h"
#import "SDLConfiguration.h"
+#import "SDLConnectionManagerType.h"
+#import "SDLError.h"
#import "SDLLifecycleConfiguration.h"
#import "SDLLockScreenConfiguration.h"
#import "SDLManagerDelegate.h"
#import "SDLProxy.h"
#import "SDLProxyFactory.h"
+#import "SDLRPCRequestFactory.h"
+#import "SDLShow.h"
+#import "SDLTextAlignment.h"
// Ignore the deprecated proxy methods
@@ -53,11 +58,37 @@ fdescribe(@"a lifecycle manager", ^{
expect(testManager.lockScreenManager).toNot(beNil());
expect(testManager.notificationDispatcher).toNot(beNil());
expect(testManager.responseDispatcher).toNot(beNil());
+ expect(@([testManager conformsToProtocol:@protocol(SDLConnectionManagerType)])).to(equal(@YES));
});
- describe(@"when started", ^{
+ describe(@"calling stop", ^{
+ beforeEach(^{
+ [testManager stop];
+ });
+
+ it(@"should do nothing", ^{
+ expect(testManager.lifecycleState).to(match(SDLLifecycleStateDisconnected));
+ });
+ });
+
+ describe(@"attempting to send a request", ^{
+ __block SDLShow *testShow = nil;
+ __block NSError *returnError = nil;
beforeEach(^{
+ testShow = [SDLRPCRequestFactory buildShowWithMainField1:@"Test" mainField2:@"Test2" alignment:[SDLTextAlignment CENTERED] correlationID:@1];
+ [testManager sendRequest:testShow withCompletionHandler:^(__kindof SDLRPCRequest * _Nullable request, __kindof SDLRPCResponse * _Nullable response, NSError * _Nullable error) {
+ returnError = error;
+ }];
+ });
+
+ it(@"should throw an error when sending a request", ^{
+ expect(returnError).to(equal([NSError sdl_lifecycle_notReadyError]));
+ });
+ });
+
+ describe(@"when started", ^{
+ beforeEach(^{
OCMExpect([proxyBuilderClassMock buildSDLProxyWithListener:[OCMArg isEqual:testManager.notificationDispatcher]]);
[testManager start];
});
@@ -65,6 +96,7 @@ fdescribe(@"a lifecycle manager", ^{
it(@"should initialize the proxy property", ^{
OCMVerifyAll(proxyBuilderClassMock);
expect(testManager.proxy).toNot(beNil());
+ expect(testManager.lifecycleState).to(match(SDLLifecycleStateDisconnected));
});
});
});