Skip to content

Commit

Permalink
add a few more early access tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahs committed Jun 21, 2021
1 parent b13ac1b commit 7919725
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/unit/early-access.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
const fs = require('fs').promises
const path = require('path')
const { testViaActionsOnly } = require('../helpers/conditional-runs')
const { getDOM } = require('../helpers/supertest')
const got = require('got')

describe('cloning early-access', () => {
testViaActionsOnly('the content directory exists', async () => {
Expand All @@ -18,3 +20,25 @@ describe('cloning early-access', () => {
expect(await fs.stat(eaDir)).toBeTruthy()
})
})

describe('rendering early-access', () => {
jest.setTimeout(5 * 60 * 1000)

testViaActionsOnly('the top-level TOC renders locally', async () => {
const $ = await getDOM('/en/early-access')
expect($.html().includes('Hello, local developer! This page is not visible on production.')).toBe(true)
expect($('ul a').length).toBeGreaterThan(5)
})

testViaActionsOnly('the top-level TOC does not render on production', async () => {
async function getEarlyAccess () {
return await got('https://docs.github.com/en/early-access')
}
await expect(getEarlyAccess).rejects.toThrowError('Response code 404 (Not Found)')
})

testViaActionsOnly('TOCs display on category pages', async () => {
const $ = await getDOM('/en/early-access/github/enforcing-best-practices-with-github-policies')
expect($('ul a').length).toBeGreaterThan(5)
})
})

0 comments on commit 7919725

Please sign in to comment.