Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
ekjotmultani committed Oct 16, 2024
1 parent e866bd6 commit 3860ad6
Showing 1 changed file with 23 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ void main() {
await Amplify.Storage.uploadData(
path: StoragePath.fromString(uploadedPaths[i]),
data: StorageDataPayload.bytes('test content'.codeUnits),
bucket: StorageBucket.fromOutputs('Storage Integ Test secondary bucket'),
bucket: StorageBucket.fromOutputs(
'Storage Integ Test secondary bucket'),
).result;
}
for (final path in uploadedPaths) {
Expand All @@ -54,17 +55,21 @@ void main() {
).result;
final listResultSecondaryBucket = await Amplify.Storage.list(
path: StoragePath.fromString(uniquePrefix),
options: StorageListOptions(bucket: StorageBucket.fromOutputs('Storage Integ Test secondary bucket')),
options: StorageListOptions(
bucket: StorageBucket.fromOutputs(
'Storage Integ Test secondary bucket')),
).result;
for (var i = 0; i < 4; i++) {
expect(
listResultMainBucket.items.any((item) => item.path == uploadedPaths[i]),
listResultMainBucket.items
.any((item) => item.path == uploadedPaths[i]),
isTrue,
);
}
for (var i = 4; i < 8; i++) {
expect(
listResultSecondaryBucket.items.any((item) => item.path == uploadedPaths[i]),
listResultSecondaryBucket.items
.any((item) => item.path == uploadedPaths[i]),
isTrue,
);
}
Expand Down Expand Up @@ -127,10 +132,11 @@ void main() {
excludeSubPaths: true,
delimiter: '#',
),
bucket: StorageBucket.fromOutputs('Storage Integ Test secondary bucket'),
bucket: StorageBucket.fromOutputs(
'Storage Integ Test secondary bucket'),
),
).result as S3ListResult;

expect(listResult.items.length, 3);
expect(listResult.items.first.path, contains('file1.txt'));

Expand All @@ -142,7 +148,8 @@ void main() {
expect(listResult.metadata.delimiter, '#');

expect(listResultSecondaryBucket.items.length, 3);
expect(listResultSecondaryBucket.items.first.path, contains('file5.txt'));
expect(listResultSecondaryBucket.items.first.path,
contains('file5.txt'));

expect(listResultSecondaryBucket.metadata.subPaths.length, 1);
expect(
Expand All @@ -168,12 +175,14 @@ void main() {
path: StoragePath.fromString(uniquePrefix),
options: StorageListOptions(
pageSize: 2,
bucket: StorageBucket.fromOutputs('Storage Integ Test secondary bucket'),
bucket: StorageBucket.fromOutputs(
'Storage Integ Test secondary bucket'),
),
).result;

expect(listResultSecondaryBucket.items.length, 2);
expect(listResultSecondaryBucket.items.first.path, contains('file5.txt'));
expect(listResultSecondaryBucket.items.first.path,
contains('file5.txt'));
});

testWidgets('should list files with pagination', (_) async {
Expand Down Expand Up @@ -208,18 +217,20 @@ void main() {
),
).result;

expect(listResult.items.length, uploadedPaths.length~/2);
expect(listResult.items.length, uploadedPaths.length ~/ 2);
expect(listResult.nextToken, isNull);

final listResultSecondaryBucket = await Amplify.Storage.list(
path: StoragePath.fromString(uniquePrefix),
options: StorageListOptions(
pluginOptions: const S3ListPluginOptions.listAll(),
bucket: StorageBucket.fromOutputs('Storage Integ Test secondary bucket'),
bucket: StorageBucket.fromOutputs(
'Storage Integ Test secondary bucket'),
),
).result;

expect(listResultSecondaryBucket.items.length, uploadedPaths.length~/2);
expect(listResultSecondaryBucket.items.length,
uploadedPaths.length ~/ 2);
expect(listResultSecondaryBucket.nextToken, isNull);
});
});
Expand Down

0 comments on commit 3860ad6

Please sign in to comment.