* Package updates * Fix up things that look broken * Add to utils * Lead now just sets font size, just use f3 where needed * Update package-lock.json * Update index.tsx * Delete bump-link.scss * Update trigger-error.js * Update components/GenericError.tsx Co-authored-by: Ash Guillaume <10384315+ashygee@users.noreply.github.com> * Update ArticlePage.tsx * Update ActionBar.tsx * Changes from meeting * Found a few more monos * Fix from a merge conflict * Missed a few f3s * Update SubLandingHero.tsx * Bye gradients * Match up breadcrumbs * Update SubLandingHero.tsx * Update lists.scss Co-authored-by: Ash Guillaume <10384315+ashygee@users.noreply.github.com>
40 lines
1.4 KiB
JavaScript
40 lines
1.4 KiB
JavaScript
import { getDOM } from '../helpers/supertest.js'
|
|
import languages from '../../lib/languages.js'
|
|
import { jest } from '@jest/globals'
|
|
|
|
jest.useFakeTimers()
|
|
|
|
describe('<head>', () => {
|
|
jest.setTimeout(5 * 60 * 1000)
|
|
|
|
test('includes hreflangs (references to all language versions of the same page)', async () => {
|
|
const $ = await getDOM('/en')
|
|
const $hreflangs = $('link[rel="alternate"]')
|
|
expect($hreflangs.length).toEqual(Object.keys(languages).length)
|
|
expect($('link[href="https://docs.github.com/cn"]').length).toBe(1)
|
|
expect($('link[href="https://docs.github.com/ja"]').length).toBe(1)
|
|
expect($('link[hrefLang="en"]').length).toBe(1)
|
|
})
|
|
|
|
test('includes page intro in `description` meta tag', async () => {
|
|
const $ = await getDOM('/en/articles/about-ssh')
|
|
const $description = $('meta[name="description"]')
|
|
expect($description.attr('content').startsWith('Using the SSH protocol')).toBe(true)
|
|
})
|
|
|
|
test('renders `description` meta tag in plaintext (no HTML)', async () => {
|
|
const $ = await getDOM('/en/articles/about-pull-request-merges')
|
|
const $description = $('meta[name="description"]')
|
|
// plain text intro
|
|
expect(
|
|
$description.attr('content').startsWith('You can merge pull requests by retaining')
|
|
).toBe(true)
|
|
// HTML intro
|
|
expect(
|
|
$('[data-testid="lead"]')
|
|
.html()
|
|
.startsWith('<p>You can <a href="/articles/merging-a-pull-request">merge pull requests</a>')
|
|
)
|
|
})
|
|
})
|