pEpObjCTests/PEPPassphraseCacheTest.m
branchIOSAD-172
changeset 1549 cf7b3b9c0e96
parent 1546 4a258d6b7b93
child 1572 f35650fadd3d
     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 +    [self.cache addPassphrase:latestPassphrase];
     1.8 +    [expectedPassphrases addObject:latestPassphrase];
     1.9  
    1.10 -    [self.cache addPassphrase:latestPassphrase];
    1.11 +    // Last added passphrase is the newest, so it comes first.
    1.12 +    expectedPassphrases = [NSMutableArray arrayWithArray:[self reversedArray:expectedPassphrases]];
    1.13  
    1.14 -    expectedPassphrases = [NSMutableArray arrayWithArray:[self reversedArray:expectedPassphrases]];
    1.15 -    [expectedPassphrases replaceObjectAtIndex:0 withObject:latestPassphrase];
    1.16 +    // There are 21 passphrases, so the oldest (last) is removed.
    1.17 +    [expectedPassphrases removeLastObject];
    1.18  
    1.19      [expectedPassphrases insertObject:@"" atIndex:0];
    1.20      XCTAssertEqualObjects(self.cache.passphrases, expectedPassphrases);