Added 2 tests for #2516 Fix extention long length of file name

This commit is contained in:
Bogdan Poplauschi 2018-10-28 20:49:44 +02:00
parent 8d788abf45
commit 6c6d848cee
1 changed files with 14 additions and 0 deletions

View File

@ -227,6 +227,20 @@ NSString *kImageTestKey = @"TestImageKey.jpg";
expect([cachePath pathExtension]).to.equal(@"");
}
- (void)test36CachePathForKeyWithURLQueryParams {
NSString *urlString = @"https://imggen.alicdn.com/3b11cea896a9438329d85abfb07b30a8.jpg?aid=tanx&tid=1166&m=%7B%22img_url%22%3A%22https%3A%2F%2Fgma.alicdn.com%2Fbao%2Fuploaded%2Fi4%2F1695306010722305097%2FTB2S2KjkHtlpuFjSspoXXbcDpXa_%21%210-saturn_solar.jpg_sum.jpg%22%2C%22title%22%3A%22%E6%A4%8D%E7%89%A9%E8%94%B7%E8%96%87%E7%8E%AB%E7%91%B0%E8%8A%B1%22%2C%22promot_name%22%3A%22%22%2C%22itemid%22%3A%22546038044448%22%7D&e=cb88dab197bfaa19804f6ec796ca906dab536b88fe6d4475795c7ee661a7ede1&size=640x246";
NSString *cachePath = [[SDImageCache sharedImageCache] cachePathForKey:urlString inPath:@""];
expect(cachePath).toNot.beNil();
expect([cachePath pathExtension]).to.equal(@"jpg");
}
- (void)test37CachePathForKeyWithTooLongExtension {
NSString *urlString = @"https://imggen.alicdn.com/3b11cea896a9438329d85abfb07b30a8.jpgasaaaaaaaaaaaaaaaaaaaajjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjaaaaaaaaaaaaaaaaajjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj";
NSString *cachePath = [[SDImageCache sharedImageCache] cachePathForKey:urlString inPath:@""];
expect(cachePath).toNot.beNil();
expect([cachePath pathExtension]).to.equal(@"");
}
- (void)test40InsertionOfImageData {
XCTestExpectation *expectation = [self expectationWithDescription:@"Insertion of image data works"];