1
1
const fs = require ( 'fs' ) . promises
2
2
const path = require ( 'path' )
3
3
const { testViaActionsOnly } = require ( '../helpers/conditional-runs' )
4
+ const { getDOM } = require ( '../helpers/supertest' )
5
+ const got = require ( 'got' )
4
6
5
7
describe ( 'cloning early-access' , ( ) => {
6
8
testViaActionsOnly ( 'the content directory exists' , async ( ) => {
@@ -18,3 +20,25 @@ describe('cloning early-access', () => {
18
20
expect ( await fs . stat ( eaDir ) ) . toBeTruthy ( )
19
21
} )
20
22
} )
23
+
24
+ describe ( 'rendering early-access' , ( ) => {
25
+ jest . setTimeout ( 5 * 60 * 1000 )
26
+
27
+ testViaActionsOnly ( 'the top-level TOC renders locally' , async ( ) => {
28
+ const $ = await getDOM ( '/en/early-access' )
29
+ expect ( $ . html ( ) . includes ( 'Hello, local developer! This page is not visible on production.' ) ) . toBe ( true )
30
+ expect ( $ ( 'ul a' ) . length ) . toBeGreaterThan ( 5 )
31
+ } )
32
+
33
+ testViaActionsOnly ( 'the top-level TOC does not render on production' , async ( ) => {
34
+ async function getEarlyAccess ( ) {
35
+ return await got ( 'https://docs.github.com/en/early-access' )
36
+ }
37
+ await expect ( getEarlyAccess ) . rejects . toThrowError ( 'Response code 404 (Not Found)' )
38
+ } )
39
+
40
+ testViaActionsOnly ( 'TOCs display on category pages' , async ( ) => {
41
+ const $ = await getDOM ( '/en/early-access/github/enforcing-best-practices-with-github-policies' )
42
+ expect ( $ ( 'ul a' ) . length ) . toBeGreaterThan ( 5 )
43
+ } )
44
+ } )
0 commit comments