IOSAD-172 Fix testTwentyOnePassphrases IOSAD-172
authorDirk Zimmermann <dz@pep.security>
Mon, 29 Jun 2020 16:39:43 +0200
branchIOSAD-172
changeset 1549cf7b3b9c0e96
parent 1548 bd20f1a6c3cc
child 1550 11f5bc962f19
IOSAD-172 Fix testTwentyOnePassphrases
pEpObjCTests/PEPPassphraseCacheTest.m
     1.1 --- a/pEpObjCTests/PEPPassphraseCacheTest.m	Mon Jun 29 16:39:43 2020 +0200
     1.2 +++ b/pEpObjCTests/PEPPassphraseCacheTest.m	Mon Jun 29 16:39:43 2020 +0200
     1.3 @@ -78,11 +78,14 @@
     1.4      }
     1.5  
     1.6      NSString *latestPassphrase = @"theLatest";
     1.7 -
     1.8      [self.cache addPassphrase:latestPassphrase];
     1.9 +    [expectedPassphrases addObject:latestPassphrase];
    1.10  
    1.11 +    // Last added passphrase is the newest, so it comes first.
    1.12      expectedPassphrases = [NSMutableArray arrayWithArray:[self reversedArray:expectedPassphrases]];
    1.13 -    [expectedPassphrases replaceObjectAtIndex:0 withObject:latestPassphrase];
    1.14 +
    1.15 +    // There are 21 passphrases, so the oldest (last) is removed.
    1.16 +    [expectedPassphrases removeLastObject];
    1.17  
    1.18      [expectedPassphrases insertObject:@"" atIndex:0];
    1.19      XCTAssertEqualObjects(self.cache.passphrases, expectedPassphrases);