summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Gluck <justin.gluck@livio.io>2019-05-31 09:29:04 -0400
committerJustin Gluck <justin.gluck@livio.io>2019-05-31 09:29:04 -0400
commit3be915dc756519bcd637c7cec66c955ec5f279ce (patch)
treea8d1d398866797c888027a56001290a6749db72e
parent9fa2c894c6779c29d3af2be1658282b8a6e90c3c (diff)
downloadsdl_ios-3be915dc756519bcd637c7cec66c955ec5f279ce.tar.gz
added unit test
-rw-r--r--SmartDeviceLinkTests/SDLMenuUpdateAlgorithmSpec.m27
1 files changed, 25 insertions, 2 deletions
diff --git a/SmartDeviceLinkTests/SDLMenuUpdateAlgorithmSpec.m b/SmartDeviceLinkTests/SDLMenuUpdateAlgorithmSpec.m
index 6ac300cc7..a8a666fb6 100644
--- a/SmartDeviceLinkTests/SDLMenuUpdateAlgorithmSpec.m
+++ b/SmartDeviceLinkTests/SDLMenuUpdateAlgorithmSpec.m
@@ -151,14 +151,37 @@ describe(@"menuUpdateAlgorithm", ^{
expect(runScore.oldStatus.count).to(equal(4));
expect(runScore.score).to(equal(0));
- expect(runScore.updatedStatus.count).to(equal(0));
-
expect(runScore.oldStatus[0].integerValue).to(equal(MenuCellStateDelete));
expect(runScore.oldStatus[1].integerValue).to(equal(MenuCellStateDelete));
expect(runScore.oldStatus[2].integerValue).to(equal(MenuCellStateDelete));
expect(runScore.oldStatus[3].integerValue).to(equal(MenuCellStateDelete));
});
+ it(@"should have menu status of 1111 and no old menu status", ^{
+ NSArray<SDLMenuCell *> *oldMenuCells = @[];
+ NSArray<SDLMenuCell *> *updatedMenuCells = @[oldCell1, oldCell2, oldCell3, oldCell4];
+
+ runScore = [SDLDynamicMenuUpdateAlgorithm compareOldMenuCells:oldMenuCells updatedMenuCells:updatedMenuCells];
+
+ expect(runScore.updatedStatus.count).to(equal(4));
+ expect(runScore.oldStatus.count).to(equal(0));
+ expect(runScore.score).to(equal(4));
+
+ expect(runScore.updatedStatus[0].integerValue).to(equal(MenuCellStateAdd));
+ expect(runScore.updatedStatus[1].integerValue).to(equal(MenuCellStateAdd));
+ expect(runScore.updatedStatus[2].integerValue).to(equal(MenuCellStateAdd));
+ expect(runScore.updatedStatus[3].integerValue).to(equal(MenuCellStateAdd));
+ });
+
+
+ it(@"should return nil of old and new menu is an empty array", ^{
+ NSArray<SDLMenuCell *> *oldMenuCells = @[];
+ NSArray<SDLMenuCell *> *updatedMenuCells = @[];
+
+ runScore = [SDLDynamicMenuUpdateAlgorithm compareOldMenuCells:oldMenuCells updatedMenuCells:updatedMenuCells];
+
+ expect(runScore).to(beNil());
+ });
});
});