forked from github/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathearly-access.js
More file actions
43 lines (35 loc) · 1.4 KB
/
early-access.js
File metadata and controls
43 lines (35 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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)
})
})