Closed Tony133 closed 3 years ago
to be evaluated :-)
Thank you for this contribution 👍
@Tony133 Could you provide more feedback about the reason for this change?
Hi @manekinekko, I made this change because I had made another pull this https://github.com/nestjs/azure-storage/pull/144
gave this error in tests:
FAIL lib/azure-storage.service.spec.ts
● AzureStorageService › should fail upload when File is null
expect(received).toBe(expected) // Object.is equality
Expected: "TypeError: Cannot destructure property `buffer` of 'undefined' or 'null'."
Received: "TypeError: Cannot destructure property 'buffer' of 'file' as it is null."
123 | await storage.upload(null);
124 | } catch (e) {
> 125 | expect(e.toString()).toBe(
| ^
126 | "TypeError: Cannot destructure property `buffer` of 'undefined' or 'null'.",
127 | );
128 | }
which has nothing to do with what I had done, so I tried to see if I could solve it.
The solution at the moment looks like this I hope it will go well.
Oh! I see what was the error.
It seems that the error message of the exception that is thrown when a file is null
, has changed:
from:
TypeError: Cannot destructure property `buffer` of 'undefined' or 'null'.
To:
TypeError: Cannot destructure property 'buffer' of 'file' as it is null.
I've sent you few changes to make before merging the PR.
Any chance this can get merged so that the build can be fixed please :pray: ? I'm keen to make use of the feature added with https://github.com/nestjs/azure-storage/pull/65 but the build has been broken since it was merged in last year :(
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information
This PR, fix test error "should fail upload when File is null"