Skip to content

Commit

Permalink
Updated test + comment
Browse files Browse the repository at this point in the history
  • Loading branch information
isoos committed Nov 30, 2023
1 parent 1581d6c commit 187cc9a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/lib/package/export_api_to_bucket.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class ApiExporter {

/// Runs a forever loop and tries to get a global lock.
///
/// Once it has the claim, it scans the packages entities and uploads
/// Once it has the claim, it scans the package entities and uploads
/// the package API JSONs to the bucket.
/// Tracks the package updates for the next up-to 24 hours and writes
/// the API JSONs after every few minutes.
Expand Down
25 changes: 18 additions & 7 deletions app/test/package/export_api_to_bucket_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,24 @@ void main() {
'current/api/packages/oxygen',
});

final currentNeon = json.decode(utf8.decode(gzip
.decode(await bucket.readAsBytes('current/api/packages/neon'))));
expect(currentNeon, {
'name': 'neon',
'latest': isNotEmpty,
'versions': isNotEmpty,
});
Future<Object?> readAndDecodeJson(String path) async => json
.decode(utf8.decode(gzip.decode(await bucket.readAsBytes(path))));

expect(
await readAndDecodeJson('current/api/packages/neon'),
{
'name': 'neon',
'latest': isNotEmpty,
'versions': hasLength(1),
},
);

expect(
await readAndDecodeJson('current/api/package-name-completion-data'),
{
'packages': hasLength(3),
},
);
},
);
});
Expand Down

0 comments on commit 187cc9a

Please sign in to comment.