diff options
author | Joel Fischer <joeljfischer@gmail.com> | 2021-08-12 10:06:59 -0400 |
---|---|---|
committer | Joel Fischer <joeljfischer@gmail.com> | 2021-08-12 10:06:59 -0400 |
commit | 2a86bb3bb553c0a3bfbb4db1ce042bb95ddad85e (patch) | |
tree | c730e5f130d92e99ea628b19c6ec5b6b97767654 | |
parent | d0ddd9a546bf09451d721a3670ecfd1315871759 (diff) | |
download | sdl_ios-2a86bb3bb553c0a3bfbb4db1ce042bb95ddad85e.tar.gz |
Fix unit tests
-rw-r--r-- | SmartDeviceLinkTests/DevAPISpecs/SDLMenuReplaceUtilitiesSpec.m | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLMenuReplaceUtilitiesSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLMenuReplaceUtilitiesSpec.m index e3a28a796..aba198781 100644 --- a/SmartDeviceLinkTests/DevAPISpecs/SDLMenuReplaceUtilitiesSpec.m +++ b/SmartDeviceLinkTests/DevAPISpecs/SDLMenuReplaceUtilitiesSpec.m @@ -363,7 +363,7 @@ describe(@"updating menu cell lists", ^{ context(@"when the cell is in the submenu", ^{ beforeEach(^{ - testCommandId = 5; + testCommandId = testMenuCells[0].subCells[0].cellId; }); it(@"should return the menu without the cell and return YES", ^{ @@ -372,7 +372,7 @@ describe(@"updating menu cell lists", ^{ expect(foundItem).to(beTrue()); expect(testMutableMenuCells).to(haveCount(3)); - expect(testMutableMenuCells[2].subCells).to(haveCount(1)); + expect(testMutableMenuCells[0].subCells).to(haveCount(1)); }); }); @@ -450,21 +450,22 @@ describe(@"updating menu cell lists", ^{ }); }); - fcontext(@"from a deep list", ^{ + context(@"from a deep list", ^{ __block SDLMenuCell *subCell = nil; __block NSMutableArray<SDLMenuCell *> *newMenu = nil; beforeEach(^{ - testMenuCells = SDLMenuReplaceUtilitiesSpecHelpers.deepMenu; + testMenuCells = SDLMenuReplaceUtilitiesSpecHelpers.deepMenu.copy; [SDLMenuReplaceUtilities updateIdsOnMenuCells:testMenuCells parentId:ParentIdNotFound]; - newMenu = SDLMenuReplaceUtilitiesSpecHelpers.deepMenu.mutableCopy; + newMenu = [[NSMutableArray alloc] initWithArray:testMenuCells copyItems:YES]; NSMutableArray<SDLMenuCell *> *subMenuToUpdate = newMenu[0].subCells.mutableCopy; + subCell = [[SDLMenuCell alloc] initWithTitle:@"New SubCell" secondaryText:nil tertiaryText:nil icon:nil secondaryArtwork:nil voiceCommands:nil handler:^(SDLTriggerSource _Nonnull triggerSource) {}]; + subCell.cellId = 98; + subCell.parentCellId = newMenu[0].cellId; [subMenuToUpdate insertObject:subCell atIndex:0]; newMenu[0].subCells = subMenuToUpdate.copy; - - [SDLMenuReplaceUtilities updateIdsOnMenuCells:newMenu parentId:ParentIdNotFound]; }); it(@"should properly add the subcell to the list", ^{ |