1
0
mirror of synced 2025-12-23 03:44:00 -05:00
Files
docs/tests/rendering/head.js
Kevin Heis 303d5190db Create a translations test suite (#30000)
* Scaffold files for migration

* Move user-agent into unit suite

* Nothing to move from browser suite

* Migrate tests to translations/content

* Migrate existing translation test to meta

* No graphql tests to migrate

* Migrate lint-translation-reporter

* Migrate lint-translation-reporter

* Remove languages-schema, unused

* Restore languages-schema

* Restore languages-schema

* Migrate rendering

* Migrate routing

* Migrate most of unit

* Remove dead files, comment out tests that aren't expected to work yet

* Migrate from get-redirect

* Migrate page and pages

* Migrate linting code

* Fix lint issues

* Found a few more

* Run prettier

* Move crowdin-config test and helper

* Update crowdin-config.js

* Remove translation linting, crowdin config lint, reduce file count

* Remove test that's been skipped for a year

* Restore linting with note to remove later

* Update lint-translation-reporter.js

* Clean up rendering suite

* Update rendering.js

* Remove excessive describe blocks

* Redirect tests

* Clean up unit

* Remove test that's never called

* Don't compare early access

* Rename test suites

* Update "content" tests

* Update files.js

* Update search.js

* Update files.js

* Update files.js
2022-08-25 12:38:03 -07:00

30 lines
1005 B
JavaScript

import { getDOM } from '../helpers/e2etest.js'
import { jest } from '@jest/globals'
jest.useFakeTimers({ legacyFakeTimers: true })
describe('<head>', () => {
jest.setTimeout(5 * 60 * 1000)
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>')
)
})
})