1
0
mirror of synced 2025-12-19 18:10:59 -05:00
Files
docs/tests/rendering/head.js
Grace Park 27aa5d92ea Remove FEATURE_NEXTJS Flag Part 1 (#20176)
* cleanup FEATURE_NEXTJS

* fixing some server tests

* updating article a for server tests

* update h2 to h4 map topic tests

* data off on TOCs

* updating dropdown article versions links

* Update so markdown renders in intros

* updating typo and all server tests are now passing

* remove nextjs feature flag

* head.js tests pass

* updating article-version-picker

* remove nextjs feature flag browser test

* update header.js tests

* fix page-titles.js test

* fix deprecated-enterprise versions

* adding early access

* testing

* getting childTocItem

* fixing table of contents to show child toc items

* updated to 2 because the sidebar article also has the same link

* remove comment

* updating pick

* Update TocLandingContext.tsx

* update package.json and change className to h4 for h2

* updating with mikes feedback

* remove a.active test

* React clean up: Delete unnecessary layouts/includes Part 2 (#20143)

* Delete unnecessary layouts

* setting back tests failing :(

* update layouts

* delete unnecessary includes

* remove github-ae-release-notes and updating layouts

* remove a.active test
2021-07-16 14:54:25 -07:00

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(
$('div.lead-mktg')
.html()
.startsWith('<p>You can <a href="/articles/merging-a-pull-request">merge pull requests</a>')
)
})
})