Skip to content

Commit

Permalink
chore: offer way to get cache names instead of CacheInfos from ListCa…
Browse files Browse the repository at this point in the history
…chesResponse (#79)

* chore: offer way to get cache names instead of CacheInfos from ListCachesResponse

* dart format
  • Loading branch information
anitarua committed Jan 8, 2024
1 parent 822f96b commit 6de1b98
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ class ListCachesSuccess implements ListCachesResponse {
String description() {
return "[ListCachesSuccess] length of caches list: ${caches.length}";
}

List<String> get cacheNames => caches.map((cache) => cache.name).toList();
}

/// Indicates that an error occurred during the list caches request.
Expand Down
5 changes: 2 additions & 3 deletions test/src/cache/cache_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void main() {
final listResp = await cacheClient.listCaches();
switch (listResp) {
case ListCachesSuccess():
final cacheNames = listResp.caches.map((cacheInfo) => cacheInfo.name);
final cacheNames = listResp.cacheNames;
expect(cacheNames.contains(newTestCacheName), true,
reason: "new cache should be in list of caches");
expect(cacheNames.contains(integrationTestCacheName), true,
Expand All @@ -87,8 +87,7 @@ void main() {
final listResp2 = await cacheClient.listCaches();
switch (listResp2) {
case ListCachesSuccess():
final cacheNames =
listResp2.caches.map((cacheInfo) => cacheInfo.name);
final cacheNames = listResp2.cacheNames;
expect(cacheNames.contains(newTestCacheName), false,
reason: "new cache should no longer be in list of caches");
expect(cacheNames.contains(integrationTestCacheName), true,
Expand Down

0 comments on commit 6de1b98

Please sign in to comment.