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

WSTEAMA-1515-added support for routes to have variants at the end #12333

Open
wants to merge 7 commits into
base: latest
Choose a base branch
from

Conversation

Nabeel1276
Copy link
Contributor

@Nabeel1276 Nabeel1276 commented Jan 24, 2025

Resolves (https://jira.dev.bbc.co.uk/browse/WSTEAMA-1514)

Overall changes

Added support for routes with variants such that the variant is at the end of the script. e.g.
Before: /service/variant/topics/id
After: /service/topics/id/variant

Code changes

  • Added getVariantTopicPageRegex function which correctly maps the variant to the end of the url as expected.
  • Added unit tests to verify that the order of the route is the correct order.
  • Added variantTopicPath as a valid path in the array.
  • Added testTopics function which ensures error handling and to return a correct response based on the route provided

Testing

  • Added unit tests.

Helpful Links

Add Links to useful resources related to this PR if applicable.

Coding Standards

Repository use guidelines

@Nabeel1276
Copy link
Contributor Author

Apologies for having this all in one commit, I made the changes on latest and then transferred them to a new branch and was having issues with git.

@Nabeel1276 Nabeel1276 self-assigned this Jan 24, 2025
Copy link
Contributor

@amoore108 amoore108 left a comment

Choose a reason for hiding this comment

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

Nice one!

Comment on lines +125 to +126
${TOPIC_PAGE} | ${'zhongwen'} | ${'trad'} | ${'live'} | ${'/zhongwen/topics/cpydz21p02et/trad'} | ${'https://mock-bff-path/?id=cpydz21p02et&service=zhongwen&pageType=topic&variant=trad&serviceEnv=live'}
${TOPIC_PAGE} | ${'zhongwen'} | ${'simp'} | ${'live'} | ${'/zhongwen/topics/c4vmr03pyn6t/simp'} | ${'https://mock-bff-path/?id=c4vmr03pyn6t&service=zhongwen&pageType=topic&variant=simp&serviceEnv=live'}
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need similar examples for local and test environments?

src/app/routes/utils/regex/utils/index.js Show resolved Hide resolved
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