1
0
mirror of synced 2025-12-22 19:34:15 -05:00
Files
docs/tests/unit/early-access.js
Peter Bengtsson 68400c52a8 don't test external early-access in unit tests (#26612)
* don't test external early-access in unit tests

* make the rendering tests less weird && gg push
2022-04-04 21:00:14 +00:00

37 lines
1.2 KiB
JavaScript

import { stat } from 'fs/promises'
import path from 'path'
import { expect } from '@jest/globals'
import { testViaActionsOnly } from '../helpers/conditional-runs.js'
import { get, getDOM } from '../helpers/e2etest.js'
describe('cloning early-access', () => {
testViaActionsOnly('the content directory exists', async () => {
const eaDir = path.join(process.cwd(), 'content/early-access')
expect(await stat(eaDir)).toBeTruthy()
})
testViaActionsOnly('the data directory exists', async () => {
const eaDir = path.join(process.cwd(), 'data/early-access')
expect(await stat(eaDir)).toBeTruthy()
})
testViaActionsOnly('the assets/images directory exists', async () => {
const eaDir = path.join(process.cwd(), 'assets/images/early-access')
expect(await stat(eaDir)).toBeTruthy()
})
})
describe('rendering early-access', () => {
testViaActionsOnly('the top-level TOC is always 404', async () => {
const res = await get('/en/early-access')
expect(res.statusCode).toBe(404)
})
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)
})
})