Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests(azure-storage-service): fix test #148

Merged
merged 3 commits into from
Jun 18, 2021
Merged

tests(azure-storage-service): fix test #148

merged 3 commits into from
Jun 18, 2021

Conversation

Tony133
Copy link
Contributor

@Tony133 Tony133 commented Jan 7, 2021

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[x] Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

This PR, fix test error "should fail upload when File is null"

@Tony133
Copy link
Contributor Author

Tony133 commented Jan 7, 2021

to be evaluated :-)

@manekinekko
Copy link
Collaborator

Thank you for this contribution 👍

@manekinekko
Copy link
Collaborator

@Tony133 Could you provide more feedback about the reason for this change?

@Tony133
Copy link
Contributor Author

Tony133 commented Jan 8, 2021

Hi @manekinekko, I made this change because I had made another pull this #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.

lib/azure-storage.service.spec.ts Outdated Show resolved Hide resolved
lib/azure-storage.service.spec.ts Outdated Show resolved Hide resolved
@manekinekko
Copy link
Collaborator

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.

@jasonpaige
Copy link

Any chance this can get merged so that the build can be fixed please 🙏 ? I'm keen to make use of the feature added with #65 but the build has been broken since it was merged in last year :(

@kamilmysliwiec kamilmysliwiec merged commit 858a1ee into nestjs:master Jun 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants