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

refactor test-translate #558

Merged
merged 4 commits into from
Dec 15, 2023
Merged

refactor test-translate #558

merged 4 commits into from
Dec 15, 2023

Conversation

zkamvar
Copy link
Contributor

@zkamvar zkamvar commented Dec 15, 2023

This refactors test-translate for preparation of refactoring the translation machinery.

  • translation pair of success/failure tests moved into expect_set_translate() function in helper-translate.R
  • expect_false(identical()) changed to expect_failure(expect_setequal()) to produce more informative error messages when they occur
  • expect_title_translate() checks that the <head><title> elements of generated pages have the expected title pattern of LESSON NAME: TRANSLATED TITLE
  • expect_h1_translate() checks that the <main><div><h1> elements of generated pages are identical to TRANSLATED TITLE

@foggleston has correctly pointed out that updating the translations in the future is going to be a bit of a slog because the developers would need to not only modify the translations used within the tr_() function, but also modify the expectations in tests/testthat/test-translate.R.

The solution is to pack all of the translated strings into a single file so that they could be evaluated later (see the commit comment on b7d380e for details). In order to do that, we should shore up the tests, which is what this PR does.

 - translation pair of success/failure tests moved into
   `expect_set_translate()` function in helper-translate.R
 - expect_false(identical()) changed to
   expect_failure(expect_setequal()) to produce more informative error
   messages when they occur
@zkamvar zkamvar marked this pull request as ready for review December 15, 2023 19:19
@zkamvar zkamvar merged commit 8e11604 into main Dec 15, 2023
12 checks passed
@zkamvar zkamvar deleted the refactor-translation-tests branch December 15, 2023 19:29
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.

1 participant