Skip to content

#199 Markdown specification (part 2 of 2) #214

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

Merged
merged 5 commits into from
Mar 10, 2025
Merged

#199 Markdown specification (part 2 of 2) #214

merged 5 commits into from
Mar 10, 2025

Conversation

kalbfled
Copy link
Member

@kalbfled kalbfled commented Mar 7, 2025

Description

These changes add more files to the tests/test_files/ subfolders to codify the expected behavior when rendering markdown as HTML or plain text, and they implement unit tests for all the test_files/ files. The new test files focus on personalization substitutions into links and block quotes, including the substitution of lists into the latter.

Substitutions into URLs of text containing spaces should be URL-safe encoded. The goal isn't that the link is valid (that's on the user); it's that the visual presentation is correct.

The unit tests include a simple happy path test and a test for missing personalization fields, both using markdown for a paragraph. I did not exhaustively test placeholders in all the various markdown permutations we might encounter because I don't think that would add value. When the tests I actually created for the hard cases pass, I am confident the functionality will work for the more straight-forward cases.

You might note that the 3 test classes I created are repetitive. Each class tests one input markdown file. With additional parametrization, I could roll all of these classes into a single test, but I rejected that implementation in favor of only loading the input files once, via a class-scoped fixture.

issue #199

How Has This Been Tested?

I ran the unit tests. The tests I added with this PR all run and fail with NotImplementedError, as is appropriate now. Subsequently, I skipped all these new tests. There are no changes required in notification-api. The next steps are #213, which builds out the implement needed to make these tests pass, and #215, which will integrate the new implementation with notification-api.

Checklist

  • I have assigned myself to this PR
  • PR has an appropriate title: #9999 - What the thing does
  • PR has a detailed description, including links to specific documentation
  • I have added the appropriate labels to the PR.
  • I did not remove any parts of the template, such as checkboxes even if they are not used
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to any documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works. Testing guidelines
  • I have ensured the latest main is merged into my branch and all checks are green prior to review
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • The ticket was moved into the DEV test column when I began testing this change

@kalbfled kalbfled self-assigned this Mar 7, 2025
@kalbfled kalbfled marked this pull request as ready for review March 7, 2025 17:27
Substitute personalization values into markdown, and return the markdown as HTML or plain text.
"""

# TODO - Perform substitutions in the markdown. Raise ValueError for missing fields.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need a ticket number on this TODO

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

if html_content is None and plain_text_content is None:
raise ValueError('You must supply one of these parameters.')

# TODO - Perform substitutions in the subject. Raise ValueError for missing fields.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More TODOs - Do we need a ticket number

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

Copy link

@cris-oddball cris-oddball left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There may be more, but I need to switch over to testing another ticket.

cris-oddball
cris-oddball previously approved these changes Mar 7, 2025
@kalbfled kalbfled requested a review from MackHalliday March 7, 2025 22:14
@kalbfled kalbfled requested a review from cris-oddball March 10, 2025 14:56
Copy link
Member

@k-macmillan k-macmillan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One question, one thing awaiting a fix. Unit tests are in a good state now.
image

Copy link
Member

@k-macmillan k-macmillan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved, would still appreciate an answer to the question though regarding action links.
Questions were answered, thanks!

Copy link

@MackHalliday MackHalliday left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved - Reviewed recent commits

@kalbfled kalbfled merged commit 23a28ce into main Mar 10, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants