@@ -26,22 +26,25 @@ void main() {
26
26
'$uniquePrefix /subdir4#file8.txt' ,
27
27
];
28
28
group ('standard config' , () {
29
+ final mainBucket =
30
+ StorageBucket .fromOutputs ('Storage Integ Test main bucket' );
31
+ final secondaryBucket = StorageBucket .fromOutputs (
32
+ 'Storage Integ Test secondary bucket' ,
33
+ );
29
34
setUpAll (() async {
30
35
await configure (amplifyEnvironments['main' ]! );
31
36
for (var i = 0 ; i < 4 ; i++ ) {
32
37
await Amplify .Storage .uploadData (
33
38
path: StoragePath .fromString (uploadedPaths[i]),
34
39
data: StorageDataPayload .bytes ('test content' .codeUnits),
35
- bucket: StorageBucket . fromOutputs ( 'Storage Integ Test main bucket' ) ,
40
+ bucket: mainBucket ,
36
41
).result;
37
42
}
38
43
for (var i = 4 ; i < 8 ; i++ ) {
39
44
await Amplify .Storage .uploadData (
40
45
path: StoragePath .fromString (uploadedPaths[i]),
41
46
data: StorageDataPayload .bytes ('test content' .codeUnits),
42
- bucket: StorageBucket .fromOutputs (
43
- 'Storage Integ Test secondary bucket' ,
44
- ),
47
+ bucket: secondaryBucket,
45
48
).result;
46
49
}
47
50
for (final path in uploadedPaths) {
@@ -51,15 +54,14 @@ void main() {
51
54
52
55
group ('list() without options' , () {
53
56
testWidgets ('should list all files with unique prefix' , (_) async {
57
+ // this will use the main bucket by default when no optional bucket is specified
54
58
final listResultMainBucket = await Amplify .Storage .list (
55
59
path: StoragePath .fromString (uniquePrefix),
56
60
).result;
57
61
final listResultSecondaryBucket = await Amplify .Storage .list (
58
62
path: StoragePath .fromString (uniquePrefix),
59
63
options: StorageListOptions (
60
- bucket: StorageBucket .fromOutputs (
61
- 'Storage Integ Test secondary bucket' ,
62
- ),
64
+ bucket: secondaryBucket,
63
65
),
64
66
).result;
65
67
for (var i = 0 ; i < 4 ; i++ ) {
@@ -135,9 +137,7 @@ void main() {
135
137
excludeSubPaths: true ,
136
138
delimiter: '#' ,
137
139
),
138
- bucket: StorageBucket .fromOutputs (
139
- 'Storage Integ Test secondary bucket' ,
140
- ),
140
+ bucket: secondaryBucket,
141
141
),
142
142
).result as S3ListResult ;
143
143
@@ -181,9 +181,7 @@ void main() {
181
181
path: StoragePath .fromString (uniquePrefix),
182
182
options: StorageListOptions (
183
183
pageSize: 2 ,
184
- bucket: StorageBucket .fromOutputs (
185
- 'Storage Integ Test secondary bucket' ,
186
- ),
184
+ bucket: secondaryBucket,
187
185
),
188
186
).result;
189
187
@@ -233,9 +231,7 @@ void main() {
233
231
path: StoragePath .fromString (uniquePrefix),
234
232
options: StorageListOptions (
235
233
pluginOptions: const S3ListPluginOptions .listAll (),
236
- bucket: StorageBucket .fromOutputs (
237
- 'Storage Integ Test secondary bucket' ,
238
- ),
234
+ bucket: secondaryBucket,
239
235
),
240
236
).result;
241
237
0 commit comments