Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Minio Dart
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
images
Minio Dart
Commits
c9a2473f
Commit
c9a2473f
authored
3 years ago
by
xuty
Browse files
Options
Downloads
Patches
Plain Diff
Add more tests
parent
0117f578
Branches
Branches containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/src/utils.dart
+6
-1
6 additions, 1 deletion
lib/src/utils.dart
test/minio_test.dart
+4
-0
4 additions, 0 deletions
test/minio_test.dart
test/utils_test.dart
+10
-0
10 additions, 0 deletions
test/utils_test.dart
with
20 additions
and
1 deletion
lib/src/utils.dart
+
6
−
1
View file @
c9a2473f
...
...
@@ -94,6 +94,8 @@ class MinChunkSize extends StreamTransformerBase<Uint8List, Uint8List> {
final
int
size
;
var
_yielded
=
false
;
@override
Stream
<
Uint8List
>
bind
(
Stream
<
Uint8List
>
stream
)
async
*
{
var
buffer
=
BytesBuilder
(
copy:
false
);
...
...
@@ -106,9 +108,12 @@ class MinChunkSize extends StreamTransformerBase<Uint8List, Uint8List> {
}
yield
buffer
.
takeBytes
();
_yielded
=
true
;
}
yield
buffer
.
takeBytes
();
if
(
buffer
.
isNotEmpty
||
!
_yielded
)
{
yield
buffer
.
takeBytes
();
}
}
}
...
...
This diff is collapsed.
Click to expand it.
test/minio_test.dart
+
4
−
0
View file @
c9a2473f
...
...
@@ -684,21 +684,25 @@ void testListObjects() {
final
minio
=
getMinioClient
();
final
bucketName
=
uniqueName
();
final
objectName
=
uniqueName
();
final
objectNameUtf8
=
uniqueName
()
+
'文件ファイル。ㄴㅁㄴ'
;
final
data
=
Uint8List
.
fromList
([
1
,
2
,
3
,
4
,
5
]);
setUpAll
(()
async
{
await
minio
.
makeBucket
(
bucketName
);
await
minio
.
putObject
(
bucketName
,
objectName
,
Stream
.
value
(
data
));
await
minio
.
putObject
(
bucketName
,
objectNameUtf8
,
Stream
.
value
(
data
));
});
tearDownAll
(()
async
{
await
minio
.
removeObject
(
bucketName
,
objectName
);
await
minio
.
removeObject
(
bucketName
,
objectNameUtf8
);
await
minio
.
removeBucket
(
bucketName
);
});
test
(
'succeeds'
,
()
async
{
final
result
=
await
minio
.
listAllObjects
(
bucketName
);
expect
(
result
.
objects
.
map
((
e
)
=
>
e
.
key
)
.
contains
(
objectName
),
isTrue
);
expect
(
result
.
objects
.
map
((
e
)
=
>
e
.
key
)
.
contains
(
objectNameUtf8
),
isTrue
);
});
test
(
'fails on invalid bucket'
,
()
{
...
...
This diff is collapsed.
Click to expand it.
test/utils_test.dart
+
10
−
0
View file @
c9a2473f
...
...
@@ -80,4 +80,14 @@ void testBlockStream() {
]),
);
});
test
(
'MinChunkSize with empty stream'
,
()
async
{
final
stream
=
Stream
<
Uint8List
>
.
empty
()
.
transform
(
MinChunkSize
(
5
));
expect
(
await
stream
.
toList
(),
equals
([
Uint8List
.
fromList
([])]));
});
test
(
'MinChunkSize with zero length stream'
,
()
async
{
final
stream
=
Stream
.
value
(
Uint8List
(
0
))
.
transform
(
MinChunkSize
(
5
));
expect
(
await
stream
.
toList
(),
equals
([
Uint8List
.
fromList
([])]));
});
}
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment