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> {
4444 ) ;
4545 }
4646
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-
5647 if ( input . expiresAt && CoreDate . from ( input . expiresAt ) . isSameOrBefore ( CoreDate . utc ( ) ) ) {
5748 validationResult . addFailure (
5849 new ValidationFailure (
Original file line number Diff line number Diff line change @@ -67,13 +67,19 @@ describe("File upload", () => {
6767 expect ( file ) . toBeDefined ( ) ;
6868
6969 const response = await transportServices1 . files . downloadFile ( { id : file . id } ) ;
70- expect ( response . isSuccess ) . toBeTruthy ( ) ;
70+ expect ( response ) . toBeSuccessful ( ) ;
71+
7172 expect ( response . value . content . byteLength ) . toBe ( 4 ) ;
7273 } ) ;
7374
74- test ( "cannot upload an empty file" , async ( ) => {
75+ test ( "can exchange an empty file" , async ( ) => {
7576 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 ) ;
7783 } ) ;
7884
7985 test ( "cannot upload a file that is null" , async ( ) => {
You can’t perform that action at this time.
0 commit comments