File tree Expand file tree Collapse file tree 2 files changed +9
-12
lines changed
src/useCases/transport/files Expand file tree Collapse file tree 2 files changed +9
-12
lines changed Original file line number Diff line number Diff line change @@ -44,15 +44,6 @@ class Validator extends SchemaValidator<UploadOwnFileValidatableRequest> {
44
44
) ;
45
45
}
46
46
47
- if ( input . content . length === 0 ) {
48
- validationResult . addFailure (
49
- new ValidationFailure (
50
- RuntimeErrors . general . invalidPropertyValue ( `'${ nameof < UploadOwnFileValidatableRequest > ( ( r ) => r . content ) } ' is empty` ) ,
51
- nameof < UploadOwnFileValidatableRequest > ( ( r ) => r . content )
52
- )
53
- ) ;
54
- }
55
-
56
47
if ( input . expiresAt && CoreDate . from ( input . expiresAt ) . isSameOrBefore ( CoreDate . utc ( ) ) ) {
57
48
validationResult . addFailure (
58
49
new ValidationFailure (
Original file line number Diff line number Diff line change @@ -67,13 +67,19 @@ describe("File upload", () => {
67
67
expect ( file ) . toBeDefined ( ) ;
68
68
69
69
const response = await transportServices1 . files . downloadFile ( { id : file . id } ) ;
70
- expect ( response . isSuccess ) . toBeTruthy ( ) ;
70
+ expect ( response ) . toBeSuccessful ( ) ;
71
+
71
72
expect ( response . value . content . byteLength ) . toBe ( 4 ) ;
72
73
} ) ;
73
74
74
- test ( "cannot upload an empty file" , async ( ) => {
75
+ test ( "can exchange an empty file" , async ( ) => {
75
76
const response = await transportServices1 . files . uploadOwnFile ( await makeUploadRequest ( { content : Buffer . of ( ) } ) ) ;
76
- expect ( response ) . toBeAnError ( "'content' is empty" , "error.runtime.validation.invalidPropertyValue" ) ;
77
+ expect ( response ) . toBeSuccessful ( ) ;
78
+
79
+ const downloadResponse = await transportServices1 . files . downloadFile ( { id : response . value . id } ) ;
80
+ expect ( downloadResponse ) . toBeSuccessful ( ) ;
81
+
82
+ expect ( downloadResponse . value . content . byteLength ) . toBe ( 0 ) ;
77
83
} ) ;
78
84
79
85
test ( "cannot upload a file that is null" , async ( ) => {
You can’t perform that action at this time.
0 commit comments