22// for details. All rights reserved. Use of this source code is governed by a
33// BSD-style license that can be found in the LICENSE file.
44
5+ import 'dart:convert' ;
56import 'dart:io' ;
67import 'dart:typed_data' ;
78
@@ -12,6 +13,7 @@ import 'package:googleapis/storage/v1.dart' show DetailedApiRequestError;
1213import 'package:logging/logging.dart' ;
1314import 'package:pub_dev/fake/backend/fake_auth_provider.dart' ;
1415import 'package:pub_dev/package/api_export/api_exporter.dart' ;
16+ import 'package:pub_dev/service/async_queue/async_queue.dart' ;
1517import 'package:pub_dev/shared/datastore.dart' ;
1618import 'package:pub_dev/shared/storage.dart' ;
1719import 'package:pub_dev/shared/utils.dart' ;
@@ -131,6 +133,10 @@ Future<void> _testExportedApiSynchronization(
131133 await bucket.readBytes ('$runtimeVersion /api/archives/foo-1.0.0.tar.gz' ),
132134 isNotNull,
133135 );
136+ expect (
137+ await bucket.readString ('$runtimeVersion /feed.atom' ),
138+ contains ('v1.0.0 of foo' ),
139+ );
134140 }
135141
136142 _log.info ('## New package' );
@@ -160,6 +166,10 @@ Future<void> _testExportedApiSynchronization(
160166 await bucket.readBytes ('latest/api/archives/foo-1.0.0.tar.gz' ),
161167 isNotNull,
162168 );
169+ expect (
170+ await bucket.readString ('$runtimeVersion /feed.atom' ),
171+ contains ('v1.0.0 of foo' ),
172+ );
163173 // Note. that name completion data won't be updated until search caches
164174 // are purged, so we won't test that it is updated.
165175
@@ -176,6 +186,10 @@ Future<void> _testExportedApiSynchronization(
176186 await bucket.readBytes ('latest/api/archives/bar-2.0.0.tar.gz' ),
177187 isNotNull,
178188 );
189+ expect (
190+ await bucket.readString ('$runtimeVersion /feed.atom' ),
191+ contains ('v2.0.0 of bar' ),
192+ );
179193 }
180194
181195 _log.info ('## New package version' );
@@ -214,6 +228,10 @@ Future<void> _testExportedApiSynchronization(
214228 await bucket.readBytes ('latest/api/archives/bar-3.0.0.tar.gz' ),
215229 isNotNull,
216230 );
231+ expect (
232+ await bucket.readString ('$runtimeVersion /feed.atom' ),
233+ contains ('v3.0.0 of bar' ),
234+ );
217235 }
218236
219237 _log.info ('## Discontinued flipped on' );
@@ -439,7 +457,7 @@ Future<void> _testExportedApiSynchronization(
439457}
440458
441459extension on Bucket {
442- /// Read bytes from bucket, retur null if missing
460+ /// Read bytes from bucket, return null if missing
443461 Future <Uint8List ?> readBytes (String path) async {
444462 try {
445463 return await readAsBytes (path);
@@ -457,4 +475,10 @@ extension on Bucket {
457475 }
458476 return utf8JsonDecoder.convert (gzip.decode (bytes));
459477 }
478+
479+ /// Read bytes from bucket and decode as UTF-8 text.
480+ Future <String > readString (String path) async {
481+ final bytes = await readBytes (path);
482+ return utf8.decode (gzip.decode (bytes! ));
483+ }
460484}
0 commit comments