1
tests/fixtures/content/get-started/index.md
vendored
1
tests/fixtures/content/get-started/index.md
vendored
@@ -25,6 +25,7 @@ children:
|
||||
- /liquid
|
||||
- /markdown
|
||||
- /images
|
||||
- /versioning
|
||||
communityRedirect:
|
||||
name: Provide HubGit Feedback
|
||||
href: 'https://hubgit.com/orgs/community/discussions/categories/get-started'
|
||||
|
||||
13
tests/fixtures/content/get-started/versioning/index.md
vendored
Normal file
13
tests/fixtures/content/get-started/versioning/index.md
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
title: Versioning
|
||||
intro: 'Testing of pages that only available in *some* versions'
|
||||
versions:
|
||||
fpt: '*'
|
||||
ghes: '*'
|
||||
ghae: '*'
|
||||
ghec: '*'
|
||||
children:
|
||||
- /only-fpt
|
||||
- /only-ghec
|
||||
- /only-ghec-and-ghes
|
||||
---
|
||||
11
tests/fixtures/content/get-started/versioning/only-fpt.md
vendored
Normal file
11
tests/fixtures/content/get-started/versioning/only-fpt.md
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
---
|
||||
title: Only in Free, Pro, & Team
|
||||
intro: Only in one version, and it's the fpt one
|
||||
versions:
|
||||
fpt: '*'
|
||||
type: how_to
|
||||
---
|
||||
|
||||
## Sample heading
|
||||
|
||||
Sample text
|
||||
12
tests/fixtures/content/get-started/versioning/only-ghec-and-ghes.md
vendored
Normal file
12
tests/fixtures/content/get-started/versioning/only-ghec-and-ghes.md
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
---
|
||||
title: Only in Enterprise Cloud and Enterprise Server
|
||||
intro: Only in two versions, and it's the ghec and ghes
|
||||
versions:
|
||||
ghec: '*'
|
||||
ghes: '*'
|
||||
type: how_to
|
||||
---
|
||||
|
||||
## Exclusive heading
|
||||
|
||||
Sample text
|
||||
11
tests/fixtures/content/get-started/versioning/only-ghec.md
vendored
Normal file
11
tests/fixtures/content/get-started/versioning/only-ghec.md
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
---
|
||||
title: Only in Enterprise Cloud
|
||||
intro: Only in one version, and it's the ghec one
|
||||
versions:
|
||||
ghec: '*'
|
||||
type: how_to
|
||||
---
|
||||
|
||||
## Exclusive heading
|
||||
|
||||
Sample text
|
||||
47
tests/rendering-fixtures/versioning.js
Normal file
47
tests/rendering-fixtures/versioning.js
Normal file
@@ -0,0 +1,47 @@
|
||||
import { expect } from '@jest/globals'
|
||||
import { getDOM, head } from '../helpers/e2etest.js'
|
||||
|
||||
describe('article versioning', () => {
|
||||
test('only links to articles for fpt', async () => {
|
||||
const $ = await getDOM('/get-started/versioning')
|
||||
const links = $('[data-testid="table-of-contents"] a')
|
||||
// Only 1 link because there's only 1 article available in fpt
|
||||
expect(links.length).toBe(1)
|
||||
expect(links.attr('href')).toBe('/en/get-started/versioning/only-fpt')
|
||||
})
|
||||
|
||||
test('only links to articles for ghae', async () => {
|
||||
const $ = await getDOM('/enterprise-cloud@latest/get-started/versioning')
|
||||
const links = $('[data-testid="table-of-contents"] a')
|
||||
expect(links.length).toBe(2)
|
||||
const first = links.filter((i) => i === 0)
|
||||
const second = links.filter((i) => i === 1)
|
||||
expect(first.attr('href')).toBe('/en/enterprise-cloud@latest/get-started/versioning/only-ghec')
|
||||
expect(second.attr('href')).toBe(
|
||||
'/en/enterprise-cloud@latest/get-started/versioning/only-ghec-and-ghes'
|
||||
)
|
||||
// Both links should 200 if you go to them
|
||||
expect((await head(first.attr('href'))).statusCode).toBe(200)
|
||||
expect((await head(second.attr('href'))).statusCode).toBe(200)
|
||||
})
|
||||
|
||||
test('wrong version prefix for a non-fpt article will 404', async () => {
|
||||
const res = await head('/enterprise-server@latest/get-started/versioning/only-ghec')
|
||||
expect(res.statusCode).toBe(404)
|
||||
})
|
||||
|
||||
test('going to articles with the wrong version will 404', async () => {
|
||||
const res = await head('/enterprise-cloud@latest/get-started/versioning/only-fpt')
|
||||
expect(res.statusCode).toBe(404)
|
||||
})
|
||||
test('going to non-fpt article with fpt prefix will redirect', async () => {
|
||||
// Viewing a ghec only article without ghec prefix
|
||||
const res = await head('/get-started/versioning/only-ghec', {
|
||||
followRedirects: false,
|
||||
})
|
||||
expect(res.statusCode).toBe(302)
|
||||
expect(res.headers.location).toBe(
|
||||
'/en/enterprise-cloud@latest/get-started/versioning/only-ghec'
|
||||
)
|
||||
})
|
||||
})
|
||||
@@ -359,34 +359,6 @@ describe('server', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('article versions', () => {
|
||||
test('includes links to all versions of each article', async () => {
|
||||
const articlePath =
|
||||
'get-started/importing-your-projects-to-github/importing-source-code-to-github/importing-a-git-repository-using-the-command-line'
|
||||
const $ = await getDOM(
|
||||
`/en/enterprise-server@${enterpriseServerReleases.latest}/${articlePath}`
|
||||
)
|
||||
// 2.13 predates this feature, so it should be excluded:
|
||||
expect(
|
||||
$(`[data-testid=version-picker] a[href="/en/enterprise/2.13/user/${articlePath}"]`).length
|
||||
).toBe(0)
|
||||
})
|
||||
|
||||
test('is not displayed if dotcom article has only one version', async () => {
|
||||
const $ = await getDOM('/en/articles/signing-up-for-a-new-github-account')
|
||||
expect($('.article-versions').length).toBe(0)
|
||||
})
|
||||
|
||||
test('is not displayed if ghec article has only one version', async () => {
|
||||
const $ = await getDOM(
|
||||
'/en/enterprise-cloud@latest/admin/managing-your-enterprise-users-with-your-identity-provider/about-enterprise-managed-users',
|
||||
{ allow404: true }
|
||||
)
|
||||
expect($.res.statusCode).toBe(404)
|
||||
expect($('.article-versions').length).toBe(0)
|
||||
})
|
||||
})
|
||||
|
||||
describeViaActionsOnly('Early Access articles', () => {
|
||||
test('have noindex meta tags', async () => {
|
||||
const allPages = await loadPages()
|
||||
|
||||
Reference in New Issue
Block a user