1
0
mirror of synced 2025-12-26 14:02:45 -05:00
Files
docs/tests/rendering/early-access.js
Laura Coursen 2bd845f23b [Megabranch] Add new top-level docset, "Migrations" (#35085)
Co-authored-by: Kevin Heis <heiskr@users.noreply.github.com>
Co-authored-by: Sarah Schneider <sarahs@github.com>
Co-authored-by: Vanessa <vgrl@github.com>
2023-03-09 14:47:35 +00:00

44 lines
1.4 KiB
JavaScript

import { expect, jest, test } from '@jest/globals'
import { get, getDOM } from '../helpers/e2etest.js'
import { describeIfDocsEarlyAccess } from '../helpers/conditional-runs.js'
import languages from '../../lib/languages.js'
const VALID_EARLY_ACCESS_URI = '/early-access/github/save-time-with-slash-commands'
describeIfDocsEarlyAccess('early access rendering', () => {
jest.setTimeout(60 * 1000)
test('viewing landing page', async () => {
const res = await get('/en/early-access')
expect(res.statusCode).toBe(404)
})
test('redirect to known docs-early-access page', async () => {
const res = await get(VALID_EARLY_ACCESS_URI)
expect(res.statusCode).toBe(302)
expect(res.headers.location).toBe(`/en${VALID_EARLY_ACCESS_URI}`)
})
test('render known docs-early-access page', async () => {
const res = await get(VALID_EARLY_ACCESS_URI, { followAllRedirects: true })
expect(res.statusCode).toBe(200)
})
test('404 if any other language than English', async () => {
for (const code of Object.keys(languages)) {
if (code === 'en') {
// This is tested elsewhere
continue
}
const res = await get(`/${code}${VALID_EARLY_ACCESS_URI}`)
expect(res.statusCode).toBe(404)
}
})
test('no language dropdown present', async () => {
const $ = await getDOM(VALID_EARLY_ACCESS_URI)
expect($('[data-testid=language-picker]').length).toBe(0)
})
})