Skip to content

Commit

Permalink
Added test for removeCachedFile
Browse files Browse the repository at this point in the history
  • Loading branch information
SmartVive committed Oct 9, 2024
1 parent b2effad commit 9d2dbe5
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions flutter_cache_manager/test/cache_store_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,24 @@ void main() {
verify(config.mockRepo
.deleteAll(argThat(containsAll([co1.id, co2.id, co3.id])))).called(1);
});

test('Store should delete file when remove cached file', () async {
var config = createTestConfig();
var store = CacheStore(config);

await config.returnsFile(fileName);
config.returnsCacheObject(fileUrl, fileName, validTill, id: 1);

var cacheObject = await store.retrieveCacheData(fileUrl);

expect(cacheObject, isNotNull);
var fileInfo = await store.getFile(cacheObject!.key);
expect(await fileInfo?.file.exists(), isTrue);

await store.removeCachedFile(cacheObject);

expect(await fileInfo?.file.exists(), isFalse);
});
});
}

Expand Down

0 comments on commit 9d2dbe5

Please sign in to comment.