Skip to content

Use hreflangCode() helper in tests instead of inline 'no'→'nb' mapping#832

Merged
pethers merged 2 commits intomain-7a9239b964b147d1from
copilot/sub-pr-817
Mar 5, 2026
Merged

Use hreflangCode() helper in tests instead of inline 'no'→'nb' mapping#832
pethers merged 2 commits intomain-7a9239b964b147d1from
copilot/sub-pr-817

Conversation

Copy link
Contributor

Copilot AI commented Mar 5, 2026

Three tests in news-generation-e2e.test.ts duplicated the Norwegian BCP-47 mapping inline (lang === 'no' ? 'nb' : lang) instead of using the shared hreflangCode() helper that production code already relies on.

Changes

  • tests/pipeline/news-generation-e2e.test.ts
    • Import hreflangCode from scripts/article-template/helpers.js
    • Replace all three inline ternaries with hreflangCode(lang) in the lang attribute, inLanguage JSON-LD, and hreflang tag consistency tests
-const expectedLangTag = lang === 'no' ? 'nb' : lang;
+const expectedLangTag = hreflangCode(lang);

-const expectedLang = lang === 'no' ? 'nb' : lang;
+const expectedLang = hreflangCode(lang);

-const expectedHreflang = lang === 'no' ? 'nb' : lang;
+const expectedHreflang = hreflangCode(lang);

Any future addition to hreflangCode() (e.g. a new language alias) now propagates to the tests automatically.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
Copilot AI changed the title [WIP] Add opposition motions analysis for 5 March 2026 Use hreflangCode() helper in tests instead of inline 'no'→'nb' mapping Mar 5, 2026
@pethers pethers marked this pull request as ready for review March 5, 2026 14:55
@pethers pethers merged commit c51a45e into main-7a9239b964b147d1 Mar 5, 2026
@pethers pethers deleted the copilot/sub-pr-817 branch March 5, 2026 14:55
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.

2 participants