1
0
mirror of synced 2026-01-07 09:01:31 -05:00
Files
docs/tests/content/featured-links.js
hubwriter 287a857511 Update Packages docs for Container registry GA (#19987)
* Update packages landing page

* Docs updates for Container reg GA

* Update billing note

* Delete CR feature preview files

* Fix broken link

* Remove github.ref from workflows

See https://github.com/github/docs-internal/pull/19953

* Put 3rd party action message in a reusable

* Update content/billing/managing-billing-for-github-packages/about-billing-for-github-packages.md

Co-authored-by: Lucas Costi <lucascosti@users.noreply.github.com>

* Update content/packages/learn-github-packages/deleting-and-restoring-a-package.md

Co-authored-by: Lucas Costi <lucascosti@users.noreply.github.com>

* Update content/packages/working-with-a-github-packages-registry/migrating-to-the-container-registry-from-the-docker-registry.md

Co-authored-by: Lucas Costi <lucascosti@users.noreply.github.com>

* Update content/packages/working-with-a-github-packages-registry/migrating-to-the-container-registry-from-the-docker-registry.md

Co-authored-by: Lucas Costi <lucascosti@users.noreply.github.com>

* Update content/packages/working-with-a-github-packages-registry/working-with-the-container-registry.md

Co-authored-by: Lucas Costi <lucascosti@users.noreply.github.com>

* Update content/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions.md

Co-authored-by: Lucas Costi <lucascosti@users.noreply.github.com>

* fix bug with wbr breaking a link inside a code tag inside a table

* Make revisions suggested by Nilofer

See https://github.com/github/docs-internal/pull/19987/files#r655014673

* Mention that migration is happening gradually

* Reapply change suggested by Shayne

* Fix punctuation

* Remove bad link

Co-authored-by: Lucas Costi <lucascosti@users.noreply.github.com>
Co-authored-by: Sarah Schneider <sarahs@github.com>
Co-authored-by: Sarah Schneider <sarahs@users.noreply.github.com>
Co-authored-by: Melanie Yarbrough <11952755+myarb@users.noreply.github.com>
2021-06-21 15:10:12 -04:00

83 lines
4.6 KiB
JavaScript

require('../../lib/feature-flags')
const { getDOM, getJSON } = require('../helpers/supertest')
const enterpriseServerReleases = require('../../lib/enterprise-server-releases')
const japaneseCharacters = require('japanese-characters')
describe('featuredLinks', () => {
jest.setTimeout(3 * 60 * 1000)
describe('rendering', () => {
test('non-TOC pages do not have intro links', async () => {
const $ = await getDOM('/en/github/getting-started-with-github/set-up-git')
expect($('.featured-links')).toHaveLength(0)
})
test('landing page intro links have expected properties', async () => {
const $ = await getDOM('/en')
const $featuredLinks = $('[data-testid=article-list] a')
expect($featuredLinks).toHaveLength(9)
expect($featuredLinks.eq(0).attr('href')).toBe('/en/github/getting-started-with-github/set-up-git')
expect($featuredLinks.eq(0).children('h4').text().startsWith('Set up Git')).toBe(true)
expect($featuredLinks.eq(0).children('p').text().startsWith('At the heart of GitHub')).toBe(true)
expect($featuredLinks.eq(8).attr('href')).toBe('/en/github/working-with-github-pages')
expect($featuredLinks.eq(8).children('h4').text().startsWith('GitHub Pages')).toBe(true)
expect($featuredLinks.eq(8).children('p').text().startsWith('You can create a website')).toBe(true)
})
test('localized intro links link to localized pages', async () => {
const $ = await getDOM('/ja')
const $featuredLinks = $('.featured-links a')
expect($featuredLinks).toHaveLength(9)
expect($featuredLinks.eq(0).attr('href').startsWith('/ja')).toBe(true)
expect(japaneseCharacters.presentIn($featuredLinks.eq(1).children('h4').text())).toBe(true)
expect(japaneseCharacters.presentIn($featuredLinks.eq(1).children('p').text())).toBe(true)
})
test('Enterprise user intro links have expected values', async () => {
const $ = await getDOM(`/en/enterprise/${enterpriseServerReleases.latest}/user/insights`)
const $featuredLinks = $('[data-testid=article-list] a')
expect($featuredLinks).toHaveLength(6)
expect($featuredLinks.eq(0).attr('href')).toBe(`/en/enterprise-server@${enterpriseServerReleases.latest}/insights/installing-and-configuring-github-insights/about-github-insights`)
expect($featuredLinks.eq(0).children('h4').text().startsWith('About GitHub Insights')).toBe(true)
expect($featuredLinks.eq(0).children('p').text().startsWith('GitHub Insights provides metrics')).toBe(true)
})
// If any of these tests fail, check to see if the content has changed and update text if needed.
test('product articles links respect versioning', async () => {
const enterpriseVersionedLandingPage = `/en/enterprise-server@${enterpriseServerReleases.latest}/packages`
const $ = await getDOM(enterpriseVersionedLandingPage)
const $productArticlesLinks = $('[data-testid=product-articles-list] a')
let msg = `Product article links are not rendered as expected on ${enterpriseVersionedLandingPage}`
expect($productArticlesLinks.length, msg).toBeGreaterThan(2)
// Confirm that the following Enterprise link IS included on this Enterprise page.
msg = `Enterprise article link is not rendered as expected on ${enterpriseVersionedLandingPage}`
expect($productArticlesLinks.text().includes('Working with a GitHub Packages registry'), msg).toBe(true)
// Confirm that the following Dotcom-only links are NOT included on this Enterprise page.
msg = `Dotcom-only article link is rendered, but should not be, on ${enterpriseVersionedLandingPage}`
expect($productArticlesLinks.text().includes('Working with the Container registry')).toBe(false)
expect($productArticlesLinks.text().includes('Migrating to the Container registry from the Docker registry'), msg).toBe(false)
})
})
describe('context.page object', () => {
test('returns modified array of links', async () => {
const gettingStartedLinks = await getJSON('/en?json=featuredLinks.gettingStarted')
const expectedFirstLink = {
href: '/en/github/getting-started-with-github/set-up-git',
title: 'Set up Git'
}
expect(gettingStartedLinks[0].href).toEqual(expectedFirstLink.href)
expect(gettingStartedLinks[0].title).toEqual(expectedFirstLink.title)
expect(gettingStartedLinks[0].intro.startsWith('At the heart of GitHub')).toBe(true)
})
test('returns raw array of links on the page object', async () => {
const rawGettingStartedLinks = await getJSON('/en?json=page.featuredLinks.gettingStarted')
expect(rawGettingStartedLinks[0]).toEqual('/github/getting-started-with-github/set-up-git')
})
})
})