@@ -497,7 +497,33 @@ - (void)testUploadCancel {
497497 [self waitForTestExpectations ];
498498}
499499
500- - (void )testClearCaches {
500+ - (void )testClearFileCache {
501+ id mockedDataSource = PFStrictProtocolMock (@protocol (PFFileManagerProvider));
502+ id mockedFileManager = PFStrictClassMock ([PFFileManager class ]);
503+
504+ NSString *temporaryPath = [self temporaryDirectory ];
505+ NSString *downloadsPath = [temporaryPath stringByAppendingPathComponent: @" downloads" ];
506+
507+ OCMStub ([mockedDataSource fileManager ]).andReturn (mockedFileManager);
508+ OCMStub ([mockedFileManager parseLocalSandboxDataDirectoryPath ]).andReturn (temporaryPath);
509+ OCMStub ([mockedFileManager parseCacheItemPathForPathComponent: @" PFFileCache" ]).andReturn (downloadsPath);
510+
511+ PFFileController *fileController = [PFFileController controllerWithDataSource: mockedDataSource];
512+ PFFileState *fileState = [[PFMutableFileState alloc ] initWithName: @" sampleData"
513+ urlString: temporaryPath
514+ mimeType: @" application/octet-stream" ];
515+
516+ XCTestExpectation *expectation = [self currentSelectorTestExpectation ];
517+ [[fileController clearFileCacheAsyncForFileWithState: fileState] continueWithBlock: ^id (BFTask *task) {
518+ XCTAssertNil (task.error );
519+ [expectation fulfill ];
520+ return nil ;
521+ }];
522+
523+ [self waitForTestExpectations ];
524+ }
525+
526+ - (void )testClearAllFilesCache {
501527 id mockedDataSource = PFStrictProtocolMock (@protocol (PFFileManagerProvider));
502528 id mockedFileManager = PFStrictClassMock ([PFFileManager class ]);
503529
@@ -511,7 +537,7 @@ - (void)testClearCaches {
511537 PFFileController *fileController = [PFFileController controllerWithDataSource: mockedDataSource];
512538
513539 XCTestExpectation *expectation = [self currentSelectorTestExpectation ];
514- [[fileController clearFileCacheAsync ] continueWithBlock: ^id (BFTask *task) {
540+ [[fileController clearAllFileCacheAsync ] continueWithBlock: ^id (BFTask *task) {
515541 XCTAssertNil (task.error );
516542 [expectation fulfill ];
517543 return nil ;
0 commit comments