Added tests for URL transformations
Walkthrough
This pull request adds comprehensive URL transformation test suites for four Ghost model types: Newsletter, Post, Snippet, and Tag. Each test file validates that image and media URLs are correctly transformed to absolute site URLs under two configurations: without CDN and with CDN enabled. The tests cover various content representations (Mobiledoc and Lexical formats for posts and snippets) and multiple asset types (feature images, og images, twitter images, media cards). A new test utility helper, stubUrlUtilsWithCdn, is introduced in the urlUtils module to enable CDN stubbing across test files.
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~25 minutes
Areas requiring extra attention:
- Verify that the new
stubUrlUtilsWithCdnhelper inurlUtils.jscorrectly passesassetBaseUrlsto the UrlUtils constructor and that CDN stubbing works as expected across all test files - Validate consistency of URL transformation expectations across different model types (Newsletter, Post, Snippet, Tag) and content formats (Mobiledoc vs. Lexical)
- Ensure setup and teardown hooks properly restore stubs and configurations after each test to prevent test pollution
- Confirm that all assertions correctly distinguish between site URL and CDN URL transformations depending on configuration state
- Review the stub for
urlService.getUrlByResourceIdto ensure it returns appropriate values for test scenarios
Pre-merge checks and finishing touches
✅ Passed checks (3 passed)
| Check name | Status | Explanation |
|---|---|---|
| Docstring Coverage | ✅ Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. |
| Title check | ✅ Passed | The pull request title accurately summarizes the main change: adding comprehensive model URL transformation tests for both CDN and non-CDN configurations across multiple model test files. |
| Description check | ✅ Passed | The PR description directly relates to the changeset, explaining the purpose of added tests for URL transformations with GHOST_URL and CDN configurations. |
✨ Finishing touches
- [ ] 📝 Generate docstrings
🧪 Generate unit tests (beta)
- [ ] Create PR with unit tests
- [ ] Post copyable unit tests in a comment
- [ ] Commit unit tests in branch
modelTestsForCDN
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands and usage tips.