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

fix: Accept string typed Subject in Personalization #974

Merged
merged 5 commits into from
Jun 5, 2020
Merged

fix: Accept string typed Subject in Personalization #974

merged 5 commits into from
Jun 5, 2020

Conversation

kampalex
Copy link
Contributor

@kampalex kampalex commented Jun 4, 2020

During work on Personalization I ran into a few issues. I've decided to split the PR to keep the overview. This PR is related to Subject.

A few unit test assertions were relying on expectedException type hints, which were triggered by setSubject() (using string value) onto Personalization. However, this is not the expected outcome but it was allowed. After fixing, I've discovered one assertion is compared against the wrong JSON expectation.

The usage suggests to allow string values for Subject. That makes sense and it can be created easily. If unwanted, please report it.

For (unrelated) unit test MailHelperTest I replaced assertEquals by compareJSONObjects. It ignores the newlines and gives no different result.

Checklist

  • I acknowledge that all my contributions will be made under the project's license
  • I have made a material change to the repo (functionality, testing, spelling, grammar)
  • I have read the Contribution Guidelines and my PR follows them
  • I have titled the PR appropriately
  • I have updated my branch with the master branch
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation about the functionality in the appropriate .md file
  • I have added inline documentation to the code I modified

kampalex added 5 commits May 19, 2020 15:38
Updated code base from upstream repository
Update repository using sendgrid/master
Sync local repository using original
Update repository using sendgrid/master
- Added support for string typed Subject (was allowed according to unit tests)
- getSubject(): added null return type if no subject is attached

Subject:
- Tabs to spaces (EditorConfig)
- TypeException hint (same namespace)

Unit tests:
MultipleEmailToMultipleRecipientsTest
- Methods testWithCollectionOfSubjects*() were failing, if providing string[] instead of Subject[], a TypeException was thrown and expected as outcome (which was incorrect)
- JSON output (which was never compared due to the TypeException) of method testWithCollectionOfSubjectsDynamic() was compared against wrong result
MailHelperTest (unrelated)
- Use compareJSONObjects instead of JSON string comparing (locally failing on newlines)

Signed-off-by: Alexander Kamp <git@akamp.nl>
@thinkingserious thinkingserious added the status: code review request requesting a community code review or review from Twilio label Jun 4, 2020
@thinkingserious
Copy link
Contributor

Nice work, thank you!

@thinkingserious thinkingserious merged commit 8ae10af into sendgrid:master Jun 5, 2020
@thinkingserious thinkingserious changed the title feat+fix: Accept string typed Subject in Personalization fix: Accept string typed Subject in Personalization Jun 8, 2020
@kampalex kampalex deleted the feature-fix-personalizations-subject branch June 8, 2020 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: code review request requesting a community code review or review from Twilio
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants