update tests to remove free-pro-team from expected results

This commit is contained in:
Sarah Schneider 2021-01-14 17:08:30 -05:00
Родитель 374112c55f
Коммит affbc80a3c
15 изменённых файлов: 258 добавлений и 256 удалений

Просмотреть файл

@ -16,11 +16,11 @@ describe('featuredLinks', () => {
const $ = await getDOM('/en')
const $featuredLinks = $('.featured-links a')
expect($featuredLinks).toHaveLength(9)
expect($featuredLinks.eq(0).attr('href')).toBe(`/en/${nonEnterpriseDefaultVersion}/github/getting-started-with-github/set-up-git`)
expect($featuredLinks.eq(0).attr('href')).toBe(`/en/github/getting-started-with-github/set-up-git`)
expect($featuredLinks.eq(0).children('h4').text().startsWith('Set up Git')).toBe(true)
expect($featuredLinks.eq(0).children('p').text().startsWith('At the heart of GitHub')).toBe(true)
expect($featuredLinks.eq(8).attr('href')).toBe(`/en/${nonEnterpriseDefaultVersion}/github/working-with-github-pages`)
expect($featuredLinks.eq(8).attr('href')).toBe(`/en/github/working-with-github-pages`)
expect($featuredLinks.eq(8).children('h4').text().startsWith('GitHub Pages')).toBe(true)
expect($featuredLinks.eq(8).children('p').text().startsWith('You can create a website')).toBe(true)
})
@ -58,7 +58,7 @@ describe('featuredLinks', () => {
test('returns modified array of links', async () => {
const gettingStartedLinks = await getJSON('/en?json=featuredLinks.gettingStarted')
const expectedFirstLink = {
href: `/en/${nonEnterpriseDefaultVersion}/github/getting-started-with-github/set-up-git`,
href: `/en/github/getting-started-with-github/set-up-git`,
title: 'Set up Git'
}
expect(gettingStartedLinks[0].href).toEqual(expectedFirstLink.href)

Просмотреть файл

@ -24,23 +24,23 @@ describe('siteTree', () => {
test('object order', () => {
expect(Object.keys(siteTree)[0]).toBe('en')
expect(Object.keys(siteTree.en)[0]).toBe(nonEnterpriseDefaultVersion)
expect(Object.keys(siteTree.en[nonEnterpriseDefaultVersion].products.github.categories)[0]).toBe(`/en/${nonEnterpriseDefaultVersion}/github/getting-started-with-github`)
expect(Object.keys(siteTree.en[nonEnterpriseDefaultVersion].products.github.categories)[0]).toBe(`/en/github/getting-started-with-github`)
})
test('object structure', () => {
expect(nonEnterpriseDefaultVersion in siteTree.en).toBe(true)
expect(`enterprise-server@${latestEnterpriseRelease}` in siteTree.en).toBe(true)
expect(flatTree[`en.${nonEnterpriseDefaultVersion}.products.github.href`]).toBe(`/en/${nonEnterpriseDefaultVersion}/github`)
expect(flatTree[`en.${nonEnterpriseDefaultVersion}.products.github.categories./en/${nonEnterpriseDefaultVersion}/github/getting-started-with-github.href`]).toBe(`/en/${nonEnterpriseDefaultVersion}/github/getting-started-with-github`)
expect(flatTree[`en.${nonEnterpriseDefaultVersion}.products.github.href`]).toBe(`/en/github`)
expect(flatTree[`en.${nonEnterpriseDefaultVersion}.products.github.categories./en/github/getting-started-with-github.href`]).toBe(`/en/github/getting-started-with-github`)
})
describe('localized titles', () => {
test('titles for categories', () => {
const japaneseTitle = flatTree[`ja.${nonEnterpriseDefaultVersion}.products.github.categories./ja/${nonEnterpriseDefaultVersion}/github/getting-started-with-github.title`]
const japaneseTitle = flatTree[`ja.${nonEnterpriseDefaultVersion}.products.github.categories./ja/github/getting-started-with-github.title`]
expect(typeof japaneseTitle).toBe('string')
expect(japaneseCharacters.presentIn(japaneseTitle)).toBe(true)
const englishTitle = flatTree[`en.${nonEnterpriseDefaultVersion}.products.github.categories./en/${nonEnterpriseDefaultVersion}/github/getting-started-with-github.title`]
const englishTitle = flatTree[`en.${nonEnterpriseDefaultVersion}.products.github.categories./en/github/getting-started-with-github.title`]
expect(typeof englishTitle).toBe('string')
expect(japaneseCharacters.presentIn(englishTitle)).toBe(false)
})

44
tests/fixtures/developer-redirects.json поставляемый
Просмотреть файл

@ -1,26 +1,26 @@
{
"/apps": "/en/free-pro-team@latest/developers/apps",
"/apps/building-github-apps": "/en/free-pro-team@latest/developers/apps/building-github-apps",
"/apps/building-oauth-apps": "/en/free-pro-team@latest/developers/apps/building-oauth-apps",
"/apps/managing-github-apps": "/en/free-pro-team@latest/developers/apps/managing-github-apps",
"/apps/managing-oauth-apps": "/en/free-pro-team@latest/developers/apps/managing-oauth-apps",
"/apps/quickstart-guides": "/en/free-pro-team@latest/developers/apps/guides",
"/marketplace": "/en/free-pro-team@latest/developers/github-marketplace",
"/marketplace/getting-started": "/en/free-pro-team@latest/developers/github-marketplace/about-github-marketplace",
"/marketplace/integrating-with-the-github-marketplace-api": "/en/free-pro-team@latest/developers/github-marketplace/using-the-github-marketplace-api-in-your-app",
"/marketplace/listing-on-github-marketplace": "/en/free-pro-team@latest/developers/github-marketplace/listing-an-app-on-github-marketplace",
"/marketplace/selling-your-app": "/en/free-pro-team@latest/developers/github-marketplace/selling-your-app-on-github-marketplace",
"/v3": "/en/free-pro-team@latest/rest",
"/v3/actions/workflow-jobs": "/en/free-pro-team@latest/rest/reference/actions#workflow-jobs",
"/v3/actions/workflow-runs": "/en/free-pro-team@latest/rest/reference/actions#workflow-runs",
"/v3/actions/workflow_jobs": "/en/free-pro-team@latest/rest/reference/actions#workflow-jobs",
"/v3/actions/workflow_runs": "/en/free-pro-team@latest/rest/reference/actions#workflow-runs",
"/v3/guides": "/en/free-pro-team@latest/rest/guides",
"/v3/guides/managing-deploy-keys": "/en/free-pro-team@latest/developers/overview/managing-deploy-keys",
"/v3/misc": "/en/free-pro-team@latest/rest/reference/emojis",
"/v4/public_schema": "/en/free-pro-team@latest/graphql/overview/public-schema",
"/v4/object/repository": "/en/free-pro-team@latest/graphql/reference/objects#repository",
"/webhooks": "/en/free-pro-team@latest/developers/webhooks-and-events/about-webhooks",
"/apps": "/en/developers/apps",
"/apps/building-github-apps": "/en/developers/apps/building-github-apps",
"/apps/building-oauth-apps": "/en/developers/apps/building-oauth-apps",
"/apps/managing-github-apps": "/en/developers/apps/managing-github-apps",
"/apps/managing-oauth-apps": "/en/developers/apps/managing-oauth-apps",
"/apps/quickstart-guides": "/en/developers/apps/guides",
"/marketplace": "/en/developers/github-marketplace",
"/marketplace/getting-started": "/en/developers/github-marketplace/about-github-marketplace",
"/marketplace/integrating-with-the-github-marketplace-api": "/en/developers/github-marketplace/using-the-github-marketplace-api-in-your-app",
"/marketplace/listing-on-github-marketplace": "/en/developers/github-marketplace/listing-an-app-on-github-marketplace",
"/marketplace/selling-your-app": "/en/developers/github-marketplace/selling-your-app-on-github-marketplace",
"/v3": "/en/rest",
"/v3/actions/workflow-jobs": "/en/rest/reference/actions#workflow-jobs",
"/v3/actions/workflow-runs": "/en/rest/reference/actions#workflow-runs",
"/v3/actions/workflow_jobs": "/en/rest/reference/actions#workflow-jobs",
"/v3/actions/workflow_runs": "/en/rest/reference/actions#workflow-runs",
"/v3/guides": "/en/rest/guides",
"/v3/guides/managing-deploy-keys": "/en/developers/overview/managing-deploy-keys",
"/v3/misc": "/en/rest/reference/emojis",
"/v4/public_schema": "/en/graphql/overview/public-schema",
"/v4/object/repository": "/en/graphql/reference/objects#repository",
"/webhooks": "/en/developers/webhooks-and-events/about-webhooks",
"/en/enterprise/2.18/apps": "/en/enterprise/2.18/user/developers/apps",
"/en/enterprise/2.18/apps/building-oauth-apps/authorizing-oauth-apps": "/en/enterprise/2.18/user/developers/apps/authorizing-oauth-apps",
"/en/enterprise/2.18/apps/building-oauth-apps/understanding-scopes-for-oauth-apps": "/en/enterprise/2.18/user/developers/apps/scopes-for-oauth-apps",

104
tests/fixtures/graphql-redirects.json поставляемый
Просмотреть файл

@ -165,32 +165,32 @@
"/en/enterprise/v4/union": "/en/enterprise-server/graphql/reference/unions",
"/en/enterprise/v4/union/assignee": "/en/enterprise-server/graphql/reference/unions#assignee",
"/en/enterprise/v4/union/auditentryactor": "/en/enterprise-server/graphql/reference/unions#auditentryactor",
"/en/v4/enum": "/en/free-pro-team@latest/graphql/reference/enums",
"/en/v4/enum/auditlogorderfield": "/en/free-pro-team@latest/graphql/reference/enums#auditlogorderfield",
"/en/v4/enum/checkannotationlevel": "/en/free-pro-team@latest/graphql/reference/enums#checkannotationlevel",
"/en/v4/guides": "/en/free-pro-team@latest/graphql/guides",
"/en/v4/input_object": "/en/free-pro-team@latest/graphql/reference/input-objects",
"/en/v4/input_object/acceptenterpriseadministratorinvitationinput": "/en/free-pro-team@latest/graphql/reference/input-objects#acceptenterpriseadministratorinvitationinput",
"/en/v4/input_object/accepttopicsuggestioninput": "/en/free-pro-team@latest/graphql/reference/input-objects#accepttopicsuggestioninput",
"/en/v4/interface": "/en/free-pro-team@latest/graphql/reference/interfaces",
"/en/v4/interface/actor": "/en/free-pro-team@latest/graphql/reference/interfaces#actor",
"/en/v4/interface/assignable": "/en/free-pro-team@latest/graphql/reference/interfaces#assignable",
"/en/v4/mutation": "/en/free-pro-team@latest/graphql/reference/mutations",
"/en/v4/mutation/acceptenterpriseadministratorinvitation": "/en/free-pro-team@latest/graphql/reference/mutations#acceptenterpriseadministratorinvitation",
"/en/v4/mutation/accepttopicsuggestion": "/en/free-pro-team@latest/graphql/reference/mutations#accepttopicsuggestion",
"/en/v4/object": "/en/free-pro-team@latest/graphql/reference/objects",
"/en/v4/object/actorlocation": "/en/free-pro-team@latest/graphql/reference/objects#actorlocation",
"/en/v4/object/addedtoprojectevent": "/en/free-pro-team@latest/graphql/reference/objects#addedtoprojectevent",
"/en/v4/previews": "/en/free-pro-team@latest/graphql/overview/schema-previews",
"/en/v4/public_schema": "/en/free-pro-team@latest/graphql/overview/public-schema",
"/en/v4/query": "/en/free-pro-team@latest/graphql/reference/queries",
"/en/v4/reference": "/en/free-pro-team@latest/graphql/reference",
"/en/v4/scalar": "/en/free-pro-team@latest/graphql/reference/scalars",
"/en/v4/scalar/boolean": "/en/free-pro-team@latest/graphql/reference/scalars#boolean",
"/en/v4/scalar/date": "/en/free-pro-team@latest/graphql/reference/scalars#date",
"/en/v4/union": "/en/free-pro-team@latest/graphql/reference/unions",
"/en/v4/union/assignee": "/en/free-pro-team@latest/graphql/reference/unions#assignee",
"/en/v4/union/auditentryactor": "/en/free-pro-team@latest/graphql/reference/unions#auditentryactor",
"/en/v4/enum": "/en/graphql/reference/enums",
"/en/v4/enum/auditlogorderfield": "/en/graphql/reference/enums#auditlogorderfield",
"/en/v4/enum/checkannotationlevel": "/en/graphql/reference/enums#checkannotationlevel",
"/en/v4/guides": "/en/graphql/guides",
"/en/v4/input_object": "/en/graphql/reference/input-objects",
"/en/v4/input_object/acceptenterpriseadministratorinvitationinput": "/en/graphql/reference/input-objects#acceptenterpriseadministratorinvitationinput",
"/en/v4/input_object/accepttopicsuggestioninput": "/en/graphql/reference/input-objects#accepttopicsuggestioninput",
"/en/v4/interface": "/en/graphql/reference/interfaces",
"/en/v4/interface/actor": "/en/graphql/reference/interfaces#actor",
"/en/v4/interface/assignable": "/en/graphql/reference/interfaces#assignable",
"/en/v4/mutation": "/en/graphql/reference/mutations",
"/en/v4/mutation/acceptenterpriseadministratorinvitation": "/en/graphql/reference/mutations#acceptenterpriseadministratorinvitation",
"/en/v4/mutation/accepttopicsuggestion": "/en/graphql/reference/mutations#accepttopicsuggestion",
"/en/v4/object": "/en/graphql/reference/objects",
"/en/v4/object/actorlocation": "/en/graphql/reference/objects#actorlocation",
"/en/v4/object/addedtoprojectevent": "/en/graphql/reference/objects#addedtoprojectevent",
"/en/v4/previews": "/en/graphql/overview/schema-previews",
"/en/v4/public_schema": "/en/graphql/overview/public-schema",
"/en/v4/query": "/en/graphql/reference/queries",
"/en/v4/reference": "/en/graphql/reference",
"/en/v4/scalar": "/en/graphql/reference/scalars",
"/en/v4/scalar/boolean": "/en/graphql/reference/scalars#boolean",
"/en/v4/scalar/date": "/en/graphql/reference/scalars#date",
"/en/v4/union": "/en/graphql/reference/unions",
"/en/v4/union/assignee": "/en/graphql/reference/unions#assignee",
"/en/v4/union/auditentryactor": "/en/graphql/reference/unions#auditentryactor",
"/enterprise/2.18/user/v4/enum": "/en/enterprise/2.18/user/graphql/reference/enums",
"/enterprise/2.18/user/v4/enum/auditlogorderfield": "/en/enterprise/2.18/user/graphql/reference/enums#auditlogorderfield",
"/enterprise/2.18/user/v4/enum/checkannotationlevel": "/en/enterprise/2.18/user/graphql/reference/enums#checkannotationlevel",
@ -367,30 +367,30 @@
"/enterprise/v4/union": "/en/enterprise-server/graphql/reference/unions",
"/enterprise/v4/union/assignee": "/en/enterprise-server/graphql/reference/unions#assignee",
"/enterprise/v4/union/auditentryactor": "/en/enterprise-server/graphql/reference/unions#auditentryactor",
"/v4/enum": "/en/free-pro-team@latest/graphql/reference/enums",
"/v4/enum/auditlogorderfield": "/en/free-pro-team@latest/graphql/reference/enums#auditlogorderfield",
"/v4/enum/checkannotationlevel": "/en/free-pro-team@latest/graphql/reference/enums#checkannotationlevel",
"/v4/guides": "/en/free-pro-team@latest/graphql/guides",
"/v4/input_object": "/en/free-pro-team@latest/graphql/reference/input-objects",
"/v4/input_object/acceptenterpriseadministratorinvitationinput": "/en/free-pro-team@latest/graphql/reference/input-objects#acceptenterpriseadministratorinvitationinput",
"/v4/input_object/accepttopicsuggestioninput": "/en/free-pro-team@latest/graphql/reference/input-objects#accepttopicsuggestioninput",
"/v4/interface": "/en/free-pro-team@latest/graphql/reference/interfaces",
"/v4/interface/actor": "/en/free-pro-team@latest/graphql/reference/interfaces#actor",
"/v4/interface/assignable": "/en/free-pro-team@latest/graphql/reference/interfaces#assignable",
"/v4/mutation": "/en/free-pro-team@latest/graphql/reference/mutations",
"/v4/mutation/acceptenterpriseadministratorinvitation": "/en/free-pro-team@latest/graphql/reference/mutations#acceptenterpriseadministratorinvitation",
"/v4/mutation/accepttopicsuggestion": "/en/free-pro-team@latest/graphql/reference/mutations#accepttopicsuggestion",
"/v4/object": "/en/free-pro-team@latest/graphql/reference/objects",
"/v4/object/actorlocation": "/en/free-pro-team@latest/graphql/reference/objects#actorlocation",
"/v4/object/addedtoprojectevent": "/en/free-pro-team@latest/graphql/reference/objects#addedtoprojectevent",
"/v4/previews": "/en/free-pro-team@latest/graphql/overview/schema-previews",
"/v4/public_schema": "/en/free-pro-team@latest/graphql/overview/public-schema",
"/v4/query": "/en/free-pro-team@latest/graphql/reference/queries",
"/v4/reference": "/en/free-pro-team@latest/graphql/reference",
"/v4/scalar": "/en/free-pro-team@latest/graphql/reference/scalars",
"/v4/scalar/boolean": "/en/free-pro-team@latest/graphql/reference/scalars#boolean",
"/v4/scalar/date": "/en/free-pro-team@latest/graphql/reference/scalars#date",
"/v4/union": "/en/free-pro-team@latest/graphql/reference/unions",
"/v4/union/assignee": "/en/free-pro-team@latest/graphql/reference/unions#assignee",
"/v4/union/auditentryactor": "/en/free-pro-team@latest/graphql/reference/unions#auditentryactor"
"/v4/enum": "/en/graphql/reference/enums",
"/v4/enum/auditlogorderfield": "/en/graphql/reference/enums#auditlogorderfield",
"/v4/enum/checkannotationlevel": "/en/graphql/reference/enums#checkannotationlevel",
"/v4/guides": "/en/graphql/guides",
"/v4/input_object": "/en/graphql/reference/input-objects",
"/v4/input_object/acceptenterpriseadministratorinvitationinput": "/en/graphql/reference/input-objects#acceptenterpriseadministratorinvitationinput",
"/v4/input_object/accepttopicsuggestioninput": "/en/graphql/reference/input-objects#accepttopicsuggestioninput",
"/v4/interface": "/en/graphql/reference/interfaces",
"/v4/interface/actor": "/en/graphql/reference/interfaces#actor",
"/v4/interface/assignable": "/en/graphql/reference/interfaces#assignable",
"/v4/mutation": "/en/graphql/reference/mutations",
"/v4/mutation/acceptenterpriseadministratorinvitation": "/en/graphql/reference/mutations#acceptenterpriseadministratorinvitation",
"/v4/mutation/accepttopicsuggestion": "/en/graphql/reference/mutations#accepttopicsuggestion",
"/v4/object": "/en/graphql/reference/objects",
"/v4/object/actorlocation": "/en/graphql/reference/objects#actorlocation",
"/v4/object/addedtoprojectevent": "/en/graphql/reference/objects#addedtoprojectevent",
"/v4/previews": "/en/graphql/overview/schema-previews",
"/v4/public_schema": "/en/graphql/overview/public-schema",
"/v4/query": "/en/graphql/reference/queries",
"/v4/reference": "/en/graphql/reference",
"/v4/scalar": "/en/graphql/reference/scalars",
"/v4/scalar/boolean": "/en/graphql/reference/scalars#boolean",
"/v4/scalar/date": "/en/graphql/reference/scalars#date",
"/v4/union": "/en/graphql/reference/unions",
"/v4/union/assignee": "/en/graphql/reference/unions#assignee",
"/v4/union/auditentryactor": "/en/graphql/reference/unions#auditentryactor"
}

210
tests/fixtures/rest-redirects.json поставляемый
Просмотреть файл

@ -385,35 +385,35 @@
"/en/enterprise/2.21/v3/users/gpg_keys": "/en/enterprise-server@2.21/rest/reference/users#gpg-keys",
"/en/enterprise/2.21/v3/users": "/en/enterprise-server@2.21/rest/reference/users",
"/en/enterprise/2.21/v3/users/keys": "/en/enterprise-server@2.21/rest/reference/users#keys",
"/v3/actions/artifacts": "/en/free-pro-team@latest/rest/reference/actions#artifacts",
"/v3/actions": "/en/free-pro-team@latest/rest/reference/actions",
"/v3/actions/secrets": "/en/free-pro-team@latest/rest/reference/actions#secrets",
"/v3/actions/self-hosted-runners": "/en/free-pro-team@latest/rest/reference/actions#self-hosted-runners",
"/v3/actions/self_hosted_runners": "/en/free-pro-team@latest/rest/reference/actions#self-hosted-runners",
"/v3/actions/workflow-jobs": "/en/free-pro-team@latest/rest/reference/actions#workflow-jobs",
"/v3/actions/workflow-runs": "/en/free-pro-team@latest/rest/reference/actions#workflow-runs",
"/v3/actions/workflows": "/en/free-pro-team@latest/rest/reference/actions#workflows",
"/v3/activity/event_types": "/en/free-pro-team@latest/developers/webhooks-and-events/github-event-types",
"/v3/activity/events/types": "/en/free-pro-team@latest/developers/webhooks-and-events/webhook-events-and-payloads",
"/v3/activity/events": "/en/free-pro-team@latest/rest/reference/activity#events",
"/v3/activity/feeds": "/en/free-pro-team@latest/rest/reference/activity#feeds",
"/v3/activity": "/en/free-pro-team@latest/rest/reference/activity",
"/v3/activity/notifications": "/en/free-pro-team@latest/rest/reference/activity#notifications",
"/v3/activity/starring": "/en/free-pro-team@latest/rest/reference/activity#starring",
"/v3/activity/watching": "/en/free-pro-team@latest/rest/reference/activity#watching",
"/v3/apps/available-endpoints": "/en/free-pro-team@latest/rest/overview/endpoints-available-for-github-apps",
"/v3/apps": "/en/free-pro-team@latest/rest/reference/apps",
"/v3/apps/installations": "/en/free-pro-team@latest/rest/reference/apps#installations",
"/v3/apps/marketplace": "/en/free-pro-team@latest/rest/reference/apps#marketplace",
"/v3/apps/oauth_applications": "/en/free-pro-team@latest/rest/reference/apps#oauth-applications",
"/v3/apps/permissions": "/en/free-pro-team@latest/rest/reference/permissions-required-for-github-apps",
"/v3/checks": "/en/free-pro-team@latest/rest/reference/checks",
"/v3/checks/runs": "/en/free-pro-team@latest/rest/reference/checks#runs",
"/v3/checks/suites": "/en/free-pro-team@latest/rest/reference/checks#suites",
"/v3/code-scanning": "/en/free-pro-team@latest/rest/reference/code-scanning",
"/v3/codes_of_conduct": "/en/free-pro-team@latest/rest/reference/codes-of-conduct",
"/v3/emojis": "/en/free-pro-team@latest/rest/reference/emojis",
"/v3/enterprise-admin": "/en/free-pro-team@latest/rest/reference/enterprise-admin",
"/v3/actions/artifacts": "/en/rest/reference/actions#artifacts",
"/v3/actions": "/en/rest/reference/actions",
"/v3/actions/secrets": "/en/rest/reference/actions#secrets",
"/v3/actions/self-hosted-runners": "/en/rest/reference/actions#self-hosted-runners",
"/v3/actions/self_hosted_runners": "/en/rest/reference/actions#self-hosted-runners",
"/v3/actions/workflow-jobs": "/en/rest/reference/actions#workflow-jobs",
"/v3/actions/workflow-runs": "/en/rest/reference/actions#workflow-runs",
"/v3/actions/workflows": "/en/rest/reference/actions#workflows",
"/v3/activity/event_types": "/en/developers/webhooks-and-events/github-event-types",
"/v3/activity/events/types": "/en/developers/webhooks-and-events/webhook-events-and-payloads",
"/v3/activity/events": "/en/rest/reference/activity#events",
"/v3/activity/feeds": "/en/rest/reference/activity#feeds",
"/v3/activity": "/en/rest/reference/activity",
"/v3/activity/notifications": "/en/rest/reference/activity#notifications",
"/v3/activity/starring": "/en/rest/reference/activity#starring",
"/v3/activity/watching": "/en/rest/reference/activity#watching",
"/v3/apps/available-endpoints": "/en/rest/overview/endpoints-available-for-github-apps",
"/v3/apps": "/en/rest/reference/apps",
"/v3/apps/installations": "/en/rest/reference/apps#installations",
"/v3/apps/marketplace": "/en/rest/reference/apps#marketplace",
"/v3/apps/oauth_applications": "/en/rest/reference/apps#oauth-applications",
"/v3/apps/permissions": "/en/rest/reference/permissions-required-for-github-apps",
"/v3/checks": "/en/rest/reference/checks",
"/v3/checks/runs": "/en/rest/reference/checks#runs",
"/v3/checks/suites": "/en/rest/reference/checks#suites",
"/v3/code-scanning": "/en/rest/reference/code-scanning",
"/v3/codes_of_conduct": "/en/rest/reference/codes-of-conduct",
"/v3/emojis": "/en/rest/reference/emojis",
"/v3/enterprise-admin": "/en/rest/reference/enterprise-admin",
"/v3/enterprise-admin/admin_stats": "/en/enterprise-server/rest/reference/enterprise-admin#admin-stats",
"/v3/enterprise-admin/global_webhooks": "/en/enterprise-server/rest/reference/enterprise-admin#global-webhooks",
"/v3/enterprise-admin/ldap": "/en/enterprise-server/rest/reference/enterprise-admin#ldap",
@ -424,83 +424,83 @@
"/v3/enterprise-admin/pre_receive_hooks": "/en/enterprise-server/rest/reference/enterprise-admin#pre-receive-hooks",
"/v3/enterprise-admin/search_indexing": "/en/enterprise-server/rest/reference/enterprise-admin#search-indexing",
"/v3/enterprise-admin/users": "/en/enterprise-server/rest/reference/enterprise-admin#users",
"/v3/gists/comments": "/en/free-pro-team@latest/rest/reference/gists#comments",
"/v3/gists": "/en/free-pro-team@latest/rest/reference/gists",
"/v3/git/blobs": "/en/free-pro-team@latest/rest/reference/git#blobs",
"/v3/git/commits": "/en/free-pro-team@latest/rest/reference/git#commits",
"/v3/git": "/en/free-pro-team@latest/rest/reference/git",
"/v3/git/refs": "/en/free-pro-team@latest/rest/reference/git#refs",
"/v3/git/tags": "/en/free-pro-team@latest/rest/reference/git#tags",
"/v3/git/trees": "/en/free-pro-team@latest/rest/reference/git#trees",
"/v3/gitignore": "/en/free-pro-team@latest/rest/reference/gitignore",
"/v3/interactions": "/en/free-pro-team@latest/rest/reference/interactions",
"/v3/interactions/orgs": "/en/free-pro-team@latest/rest/reference/interactions#orgs",
"/v3/interactions/repos": "/en/free-pro-team@latest/rest/reference/interactions#repos",
"/v3/issues/assignees": "/en/free-pro-team@latest/rest/reference/issues#assignees",
"/v3/issues/comments": "/en/free-pro-team@latest/rest/reference/issues#comments",
"/v3/issues/events": "/en/free-pro-team@latest/rest/reference/issues#events",
"/v3/issues": "/en/free-pro-team@latest/rest/reference/issues",
"/v3/issues/issue-event-types": "/en/free-pro-team@latest/developers/webhooks-and-events/issue-event-types",
"/v3/issues/labels": "/en/free-pro-team@latest/rest/reference/issues#labels",
"/v3/issues/milestones": "/en/free-pro-team@latest/rest/reference/issues#milestones",
"/v3/issues/timeline": "/en/free-pro-team@latest/rest/reference/issues#timeline",
"/v3/licenses": "/en/free-pro-team@latest/rest/reference/licenses",
"/v3/markdown": "/en/free-pro-team@latest/rest/reference/markdown",
"/v3/meta": "/en/free-pro-team@latest/rest/reference/meta",
"/v3/migrations": "/en/free-pro-team@latest/rest/reference/migrations",
"/v3/migrations/orgs": "/en/free-pro-team@latest/rest/reference/migrations#orgs",
"/v3/migrations/source_imports": "/en/free-pro-team@latest/rest/reference/migrations#source-imports",
"/v3/migrations/users": "/en/free-pro-team@latest/rest/reference/migrations#users",
"/v3/gists/comments": "/en/rest/reference/gists#comments",
"/v3/gists": "/en/rest/reference/gists",
"/v3/git/blobs": "/en/rest/reference/git#blobs",
"/v3/git/commits": "/en/rest/reference/git#commits",
"/v3/git": "/en/rest/reference/git",
"/v3/git/refs": "/en/rest/reference/git#refs",
"/v3/git/tags": "/en/rest/reference/git#tags",
"/v3/git/trees": "/en/rest/reference/git#trees",
"/v3/gitignore": "/en/rest/reference/gitignore",
"/v3/interactions": "/en/rest/reference/interactions",
"/v3/interactions/orgs": "/en/rest/reference/interactions#orgs",
"/v3/interactions/repos": "/en/rest/reference/interactions#repos",
"/v3/issues/assignees": "/en/rest/reference/issues#assignees",
"/v3/issues/comments": "/en/rest/reference/issues#comments",
"/v3/issues/events": "/en/rest/reference/issues#events",
"/v3/issues": "/en/rest/reference/issues",
"/v3/issues/issue-event-types": "/en/developers/webhooks-and-events/issue-event-types",
"/v3/issues/labels": "/en/rest/reference/issues#labels",
"/v3/issues/milestones": "/en/rest/reference/issues#milestones",
"/v3/issues/timeline": "/en/rest/reference/issues#timeline",
"/v3/licenses": "/en/rest/reference/licenses",
"/v3/markdown": "/en/rest/reference/markdown",
"/v3/meta": "/en/rest/reference/meta",
"/v3/migrations": "/en/rest/reference/migrations",
"/v3/migrations/orgs": "/en/rest/reference/migrations#orgs",
"/v3/migrations/source_imports": "/en/rest/reference/migrations#source-imports",
"/v3/migrations/users": "/en/rest/reference/migrations#users",
"/v3/oauth_authorizations": "/en/enterprise-server/rest/reference/oauth-authorizations",
"/v3/orgs/blocking": "/en/free-pro-team@latest/rest/reference/orgs#blocking",
"/v3/orgs/hooks": "/en/free-pro-team@latest/rest/reference/orgs#webhooks",
"/v3/orgs": "/en/free-pro-team@latest/rest/reference/orgs",
"/v3/orgs/members": "/en/free-pro-team@latest/rest/reference/orgs#members",
"/v3/orgs/migrations": "/en/free-pro-team@latest/rest/reference/orgs#migrations",
"/v3/orgs/outside_collaborators": "/en/free-pro-team@latest/rest/reference/orgs#outside-collaborators",
"/v3/orgs/blocking": "/en/rest/reference/orgs#blocking",
"/v3/orgs/hooks": "/en/rest/reference/orgs#webhooks",
"/v3/orgs": "/en/rest/reference/orgs",
"/v3/orgs/members": "/en/rest/reference/orgs#members",
"/v3/orgs/migrations": "/en/rest/reference/orgs#migrations",
"/v3/orgs/outside_collaborators": "/en/rest/reference/orgs#outside-collaborators",
"/v3/orgs/pre_receive_hooks": "/en/enterprise-server/rest/reference/enterprise-admin#organization-pre-receive-hooks",
"/v3/orgs/teams": "/en/free-pro-team@latest/rest/reference/orgs#teams",
"/v3/projects/cards": "/en/free-pro-team@latest/rest/reference/projects#cards",
"/v3/projects/collaborators": "/en/free-pro-team@latest/rest/reference/projects#collaborators",
"/v3/projects/columns": "/en/free-pro-team@latest/rest/reference/projects#columns",
"/v3/projects": "/en/free-pro-team@latest/rest/reference/projects",
"/v3/pulls/comments": "/en/free-pro-team@latest/rest/reference/pulls#comments",
"/v3/pulls": "/en/free-pro-team@latest/rest/reference/pulls",
"/v3/pulls/review_requests": "/en/free-pro-team@latest/rest/reference/pulls#review-requests",
"/v3/pulls/reviews": "/en/free-pro-team@latest/rest/reference/pulls#reviews",
"/v3/rate_limit": "/en/free-pro-team@latest/rest/reference/rate-limit",
"/v3/reactions": "/en/free-pro-team@latest/rest/reference/reactions",
"/v3/repos/branches": "/en/free-pro-team@latest/rest/reference/repos#branches",
"/v3/repos/collaborators": "/en/free-pro-team@latest/rest/reference/repos#collaborators",
"/v3/repos/comments": "/en/free-pro-team@latest/rest/reference/repos#comments",
"/v3/repos/commits": "/en/free-pro-team@latest/rest/reference/repos#commits",
"/v3/repos/community": "/en/free-pro-team@latest/rest/reference/repos#community",
"/v3/repos/contents": "/en/free-pro-team@latest/rest/reference/repos#contents",
"/v3/repos/deployments": "/en/free-pro-team@latest/rest/reference/repos#deployments",
"/v3/repos/downloads": "/en/free-pro-team@latest/rest/reference/repos#downloads",
"/v3/repos/forks": "/en/free-pro-team@latest/rest/reference/repos#forks",
"/v3/repos/hooks": "/en/free-pro-team@latest/rest/reference/repos#webhooks",
"/v3/repos": "/en/free-pro-team@latest/rest/reference/repos",
"/v3/repos/invitations": "/en/free-pro-team@latest/rest/reference/repos#invitations",
"/v3/repos/keys": "/en/free-pro-team@latest/rest/reference/repos#keys",
"/v3/repos/merging": "/en/free-pro-team@latest/rest/reference/repos#merging",
"/v3/repos/pages": "/en/free-pro-team@latest/rest/reference/repos#pages",
"/v3/orgs/teams": "/en/rest/reference/orgs#teams",
"/v3/projects/cards": "/en/rest/reference/projects#cards",
"/v3/projects/collaborators": "/en/rest/reference/projects#collaborators",
"/v3/projects/columns": "/en/rest/reference/projects#columns",
"/v3/projects": "/en/rest/reference/projects",
"/v3/pulls/comments": "/en/rest/reference/pulls#comments",
"/v3/pulls": "/en/rest/reference/pulls",
"/v3/pulls/review_requests": "/en/rest/reference/pulls#review-requests",
"/v3/pulls/reviews": "/en/rest/reference/pulls#reviews",
"/v3/rate_limit": "/en/rest/reference/rate-limit",
"/v3/reactions": "/en/rest/reference/reactions",
"/v3/repos/branches": "/en/rest/reference/repos#branches",
"/v3/repos/collaborators": "/en/rest/reference/repos#collaborators",
"/v3/repos/comments": "/en/rest/reference/repos#comments",
"/v3/repos/commits": "/en/rest/reference/repos#commits",
"/v3/repos/community": "/en/rest/reference/repos#community",
"/v3/repos/contents": "/en/rest/reference/repos#contents",
"/v3/repos/deployments": "/en/rest/reference/repos#deployments",
"/v3/repos/downloads": "/en/rest/reference/repos#downloads",
"/v3/repos/forks": "/en/rest/reference/repos#forks",
"/v3/repos/hooks": "/en/rest/reference/repos#webhooks",
"/v3/repos": "/en/rest/reference/repos",
"/v3/repos/invitations": "/en/rest/reference/repos#invitations",
"/v3/repos/keys": "/en/rest/reference/repos#keys",
"/v3/repos/merging": "/en/rest/reference/repos#merging",
"/v3/repos/pages": "/en/rest/reference/repos#pages",
"/v3/repos/pre_receive_hooks": "/en/enterprise-server/rest/reference/enterprise-admin#repository-pre-receive-hooks",
"/v3/repos/releases": "/en/free-pro-team@latest/rest/reference/repos#releases",
"/v3/repos/statistics": "/en/free-pro-team@latest/rest/reference/repos#statistics",
"/v3/repos/statuses": "/en/free-pro-team@latest/rest/reference/repos#statuses",
"/v3/repos/traffic": "/en/free-pro-team@latest/rest/reference/repos#traffic",
"/v3/scim": "/en/free-pro-team@latest/rest/reference/scim",
"/v3/search": "/en/free-pro-team@latest/rest/reference/search",
"/v3/teams/discussion_comments": "/en/free-pro-team@latest/rest/reference/teams#discussion-comments",
"/v3/teams/discussions": "/en/free-pro-team@latest/rest/reference/teams#discussions",
"/v3/teams": "/en/free-pro-team@latest/rest/reference/teams",
"/v3/teams/members": "/en/free-pro-team@latest/rest/reference/teams#members",
"/v3/teams/team_sync": "/en/free-pro-team@latest/rest/reference/teams#team-sync",
"/v3/users/blocking": "/en/free-pro-team@latest/rest/reference/users#blocking",
"/v3/users/emails": "/en/free-pro-team@latest/rest/reference/users#emails",
"/v3/users/followers": "/en/free-pro-team@latest/rest/reference/users#followers",
"/v3/users/gpg_keys": "/en/free-pro-team@latest/rest/reference/users#gpg-keys",
"/v3/users": "/en/free-pro-team@latest/rest/reference/users",
"/v3/users/keys": "/en/free-pro-team@latest/rest/reference/users#keys"
"/v3/repos/releases": "/en/rest/reference/repos#releases",
"/v3/repos/statistics": "/en/rest/reference/repos#statistics",
"/v3/repos/statuses": "/en/rest/reference/repos#statuses",
"/v3/repos/traffic": "/en/rest/reference/repos#traffic",
"/v3/scim": "/en/rest/reference/scim",
"/v3/search": "/en/rest/reference/search",
"/v3/teams/discussion_comments": "/en/rest/reference/teams#discussion-comments",
"/v3/teams/discussions": "/en/rest/reference/teams#discussions",
"/v3/teams": "/en/rest/reference/teams",
"/v3/teams/members": "/en/rest/reference/teams#members",
"/v3/teams/team_sync": "/en/rest/reference/teams#team-sync",
"/v3/users/blocking": "/en/rest/reference/users#blocking",
"/v3/users/emails": "/en/rest/reference/users#emails",
"/v3/users/followers": "/en/rest/reference/users#followers",
"/v3/users/gpg_keys": "/en/rest/reference/users#gpg-keys",
"/v3/users": "/en/rest/reference/users",
"/v3/users/keys": "/en/rest/reference/users#keys"
}

Просмотреть файл

@ -52,13 +52,13 @@ describe('breadcrumbs', () => {
test('English breadcrumbs link to English pages', async () => {
const $ = await getDOM('/en/github/getting-started-with-github')
const $breadcrumbs = $('.breadcrumbs a')
expect($breadcrumbs.eq(0).attr('href')).toBe(`/en/${nonEnterpriseDefaultVersion}/github`)
expect($breadcrumbs.eq(0).attr('href')).toBe(`/en/github`)
})
test('localized breadcrumbs link to localize pages', async () => {
const $ = await getDOM('/ja/github/getting-started-with-github')
const $breadcrumbs = $('.breadcrumbs a')
expect($breadcrumbs.eq(0).attr('href')).toBe(`/ja/${nonEnterpriseDefaultVersion}/github`)
expect($breadcrumbs.eq(0).attr('href')).toBe(`/ja/github`)
})
})
@ -88,7 +88,7 @@ describe('breadcrumbs', () => {
const breadcrumbs = await getJSON('/en/github?json=breadcrumbs')
const expected = {
product: {
href: `/en/${nonEnterpriseDefaultVersion}/github`,
href: `/en/github`,
title: 'GitHub.com'
}
}
@ -99,11 +99,11 @@ describe('breadcrumbs', () => {
const breadcrumbs = await getJSON('/en/github/authenticating-to-github?json=breadcrumbs')
const expected = {
product: {
href: `/en/${nonEnterpriseDefaultVersion}/github`,
href: `/en/github`,
title: 'GitHub.com'
},
category: {
href: `/en/${nonEnterpriseDefaultVersion}/github/authenticating-to-github`,
href: `/en/github/authenticating-to-github`,
title: 'Authentication'
}
}
@ -114,15 +114,15 @@ describe('breadcrumbs', () => {
const breadcrumbs = await getJSON('/en/github/authenticating-to-github/keeping-your-account-and-data-secure?json=breadcrumbs')
const expected = {
product: {
href: `/en/${nonEnterpriseDefaultVersion}/github`,
href: `/en/github`,
title: 'GitHub.com'
},
category: {
href: `/en/${nonEnterpriseDefaultVersion}/github/authenticating-to-github`,
href: `/en/github/authenticating-to-github`,
title: 'Authentication'
},
maptopic: {
href: `/en/${nonEnterpriseDefaultVersion}/github/authenticating-to-github/keeping-your-account-and-data-secure`,
href: `/en/github/authenticating-to-github/keeping-your-account-and-data-secure`,
title: 'Keeping your account and data secure'
}
}
@ -133,19 +133,19 @@ describe('breadcrumbs', () => {
const breadcrumbs = await getJSON('/en/github/authenticating-to-github/creating-a-strong-password?json=breadcrumbs')
const expected = {
product: {
href: `/en/${nonEnterpriseDefaultVersion}/github`,
href: `/en/github`,
title: 'GitHub.com'
},
category: {
href: `/en/${nonEnterpriseDefaultVersion}/github/authenticating-to-github`,
href: `/en/github/authenticating-to-github`,
title: 'Authentication'
},
maptopic: {
href: `/en/${nonEnterpriseDefaultVersion}/github/authenticating-to-github/keeping-your-account-and-data-secure`,
href: `/en/github/authenticating-to-github/keeping-your-account-and-data-secure`,
title: 'Keeping your account and data secure'
},
article: {
href: `/en/${nonEnterpriseDefaultVersion}/github/authenticating-to-github/creating-a-strong-password`,
href: `/en/github/authenticating-to-github/creating-a-strong-password`,
title: 'Creating a strong password'
}
}
@ -156,15 +156,15 @@ describe('breadcrumbs', () => {
const breadcrumbs = await getJSON('/github/site-policy/github-privacy-statement?json=breadcrumbs')
const expected = {
product: {
href: `/en/${nonEnterpriseDefaultVersion}/github`,
href: `/en/github`,
title: 'GitHub.com'
},
category: {
href: `/en/${nonEnterpriseDefaultVersion}/github/site-policy`,
href: `/en/github/site-policy`,
title: 'Site policy'
},
article: {
href: `/en/${nonEnterpriseDefaultVersion}/github/site-policy/github-privacy-statement`,
href: `/en/github/site-policy/github-privacy-statement`,
title: 'GitHub Privacy Statement'
}
}

Просмотреть файл

@ -22,7 +22,7 @@ describe('header', () => {
describe('language links', () => {
test('lead to the same page in a different language', async () => {
const $ = await getDOM('/en/github/administering-a-repository/enabling-required-status-checks')
expect($(`#languages-selector a[href="/ja/${nonEnterpriseDefaultVersion}/github/administering-a-repository/enabling-required-status-checks"]`).length).toBe(1)
expect($(`#languages-selector a[href="/ja/github/administering-a-repository/enabling-required-status-checks"]`).length).toBe(1)
})
test('display the native name and the English name for each translated language', async () => {
@ -68,7 +68,7 @@ describe('header', () => {
test('include github and admin, and emphasize the current product', async () => {
const $ = await getDOM('/en/articles/enabling-required-status-checks')
const github = $(`#homepages a.active[href="/en/${nonEnterpriseDefaultVersion}/github"]`)
const github = $(`#homepages a.active[href="/en/github"]`)
expect(github.length).toBe(1)
expect(github.text().trim()).toBe('GitHub.com')
expect(github.attr('class').includes('active')).toBe(true)
@ -82,15 +82,15 @@ describe('header', () => {
test('point to homepages in the current page\'s language', async () => {
const $ = await getDOM('/ja/articles/enabling-required-status-checks')
expect($(`#homepages a.active[href="/ja/${nonEnterpriseDefaultVersion}/github"]`).length).toBe(1)
expect($(`#homepages a.active[href="/ja/github"]`).length).toBe(1)
expect($(`#homepages a[href="/ja/enterprise-server@${latest}/admin"]`).length).toBe(1)
})
test('emphasizes the product that corresponds to the current page', async () => {
const $ = await getDOM(`/en/enterprise/${oldestSupported}/user/github/setting-up-and-managing-your-github-user-account/setting-your-commit-email-address`)
expect($(`#homepages a.active[href="/en/enterprise-server@${latest}/admin"]`).length).toBe(0)
expect($(`#homepages a[href="/en/${nonEnterpriseDefaultVersion}/github"]`).length).toBe(1)
expect($(`#homepages a.active[href="/en/${nonEnterpriseDefaultVersion}/github"]`).length).toBe(1)
expect($(`#homepages a[href="/en/github"]`).length).toBe(1)
expect($(`#homepages a.active[href="/en/github"]`).length).toBe(1)
})
})
})

Просмотреть файл

@ -214,7 +214,7 @@ describe('server', () => {
test('displays links to categories on product TOCs', async () => {
const $ = await getDOM('/en/github')
expect($(`article a[href="/en/${nonEnterpriseDefaultVersion}/github/getting-started-with-github"]`)).toHaveLength(1)
expect($(`article a[href="/en/github/getting-started-with-github"]`)).toHaveLength(1)
})
describe('autogenerated mini TOCs', () => {
@ -296,7 +296,7 @@ describe('server', () => {
test('dotcom articles on dotcom have links that include "en"', async () => {
const $ = await getDOM('/en/articles/set-up-git')
expect($(`a[href="/en/${nonEnterpriseDefaultVersion}/articles/managing-files-on-github"]`).length).toBe(1)
expect($(`a[href="/en/articles/managing-files-on-github"]`).length).toBe(1)
})
test('dotcom articles on dotcom have Enterprise Admin links with latest GHE version', async () => {
@ -316,12 +316,12 @@ describe('server', () => {
test('dotcom-only links on GHE are dotcom-only', async () => {
const $ = await getDOM(`${latestEnterprisePath}/github/setting-up-and-managing-your-github-profile/sending-your-github-enterprise-server-contributions-to-your-githubcom-profile`)
expect($(`article a[href="/en/${nonEnterpriseDefaultVersion}/articles/github-privacy-statement"]`).length).toBe(1)
expect($(`article a[href="/en/articles/github-privacy-statement"]`).length).toBe(1)
})
test('desktop links on GHE are dotcom-only', async () => {
const $ = await getDOM(`${latestEnterprisePath}/github/getting-started-with-github/set-up-git`)
expect($(`article a[href="/en/${nonEnterpriseDefaultVersion}/desktop/installing-and-configuring-github-desktop"]`).length).toBe(1)
expect($(`article a[href="/en/desktop/installing-and-configuring-github-desktop"]`).length).toBe(1)
})
test('admin articles that link to non-admin articles have Enterprise user links', async () => {
@ -405,7 +405,7 @@ describe('server', () => {
test('redirects old articles to their slugified URL', async () => {
const res = await get('/articles/about-github-s-ip-addresses')
expect(res.text).toBe(`Moved Permanently. Redirecting to /en/${nonEnterpriseDefaultVersion}/github/authenticating-to-github/about-githubs-ip-addresses`)
expect(res.text).toBe(`Moved Permanently. Redirecting to /en/github/authenticating-to-github/about-githubs-ip-addresses`)
})
test('redirects / to /en', async () => {
@ -444,13 +444,13 @@ describe('server', () => {
describe('categories and map topics', () => {
test('adds links to categories on the dotcom homepage', async () => {
const $ = await getDOM('/en/github')
expect($(`article a[href="/en/${nonEnterpriseDefaultVersion}/github/managing-large-files"]`).length).toBe(1)
expect($(`article a[href="/en/github/managing-large-files"]`).length).toBe(1)
expect($('article a[href="#managing-large-files"]').length).toBe(0)
})
test('adds links to map topics on a category homepage', async () => {
const $ = await getDOM('/en/github/setting-up-and-managing-your-github-user-account')
expect($(`article a[href="/en/${nonEnterpriseDefaultVersion}/github/setting-up-and-managing-your-github-user-account/managing-user-account-settings"]`).length).toBe(1)
expect($(`article a[href="/en/github/setting-up-and-managing-your-github-user-account/managing-user-account-settings"]`).length).toBe(1)
expect($('article a[href="#managing-user-account-settings"]').length).toBe(0)
})
@ -461,7 +461,7 @@ describe('server', () => {
test('map topic renders with h2 links to articles', async () => {
const $ = await getDOM('/en/github/setting-up-and-managing-your-github-user-account/managing-user-account-settings')
expect($(`a[href="/en/${nonEnterpriseDefaultVersion}/github/setting-up-and-managing-your-github-user-account/changing-your-github-username"] h2`).length).toBe(1)
expect($(`a[href="/en/github/setting-up-and-managing-your-github-user-account/changing-your-github-username"] h2`).length).toBe(1)
})
test('map topic renders with one intro for every h2', async () => {
@ -572,26 +572,26 @@ describe('GitHub Enterprise URLs', () => {
describe('GitHub Desktop URLs', () => {
test('renders the GitHub Desktop homepage with correct links', async () => {
const $ = await getDOM('/en/desktop')
expect($(`article a[href^="/en/${nonEnterpriseDefaultVersion}/desktop/"]`).length).toBeGreaterThan(1)
expect($(`article a[href^="/en/desktop/"]`).length).toBeGreaterThan(1)
})
test('renders a Desktop category with expected links', async () => {
const $ = await getDOM('/en/desktop/installing-and-configuring-github-desktop')
expect($(`article a[href^="/en/${nonEnterpriseDefaultVersion}/desktop/installing-and-configuring-github-desktop/"]`).length).toBeGreaterThan(1)
expect($(`article a[href^="/en/desktop/installing-and-configuring-github-desktop/"]`).length).toBeGreaterThan(1)
})
test('renders a Desktop map topic', async () => {
const $ = await getDOM('/en/desktop/installing-and-configuring-github-desktop/installing-and-authenticating-to-github-desktop')
expect($(`article a[href^="/en/${nonEnterpriseDefaultVersion}/desktop/installing-and-configuring-github-desktop/"]`).length).toBeGreaterThan(1)
expect($(`article a[href^="/en/desktop/installing-and-configuring-github-desktop/"]`).length).toBeGreaterThan(1)
})
test('renders a Desktop article within a map topic', async () => {
const res = await get(`/en/${nonEnterpriseDefaultVersion}/desktop/installing-and-configuring-github-desktop/installing-github-desktop`)
const res = await get(`/en/desktop/installing-and-configuring-github-desktop/installing-github-desktop`)
expect(res.statusCode).toBe(200)
})
test('renders the Desktop homepage in Japanese', async () => {
const res = await get(`/ja/${nonEnterpriseDefaultVersion}/desktop`)
const res = await get(`/ja/desktop`)
expect(res.statusCode).toBe(200)
})
})
@ -743,7 +743,7 @@ describe('static routes', () => {
})
describe('index pages', () => {
const nonEnterpriseOnlyPath = `/en/${nonEnterpriseDefaultVersion}/github/getting-started-with-github/verifying-your-email-address`
const nonEnterpriseOnlyPath = `/en/github/getting-started-with-github/verifying-your-email-address`
test('includes dotcom-only links in dotcom TOC', async () => {
const $ = await getDOM('/en/github/getting-started-with-github')

Просмотреть файл

@ -31,7 +31,7 @@ describe('sidebar', () => {
})
test('adds an `is-current-page` class to the sidebar link to the current page', async () => {
const url = `/en/${nonEnterpriseDefaultVersion}/github/setting-up-and-managing-your-github-user-account/managing-user-account-settings`
const url = `/en/github/setting-up-and-managing-your-github-user-account/managing-user-account-settings`
const $ = await getDOM(url)
expect($('.sidebar .is-current-page').length).toBe(1)
expect($('.sidebar .is-current-page a').attr('href')).toContain(url)

Просмотреть файл

@ -1,3 +1,4 @@
const path = require('path')
const { eachOfLimit } = require('async')
const enterpriseServerReleases = require('../../lib/enterprise-server-releases')
const { get } = require('../helpers/supertest')
@ -22,7 +23,7 @@ describe('developer redirects', () => {
test('graphql homepage', async () => {
const res = await get('/v4')
expect(res.statusCode).toBe(301)
const expectedFinalPath = `/en/${nonEnterpriseDefaultVersion}/graphql`
const expectedFinalPath = `/en/graphql`
expect(res.headers.location).toBe(expectedFinalPath)
})
@ -36,7 +37,7 @@ describe('developer redirects', () => {
test('graphql overview paths', async () => {
const oldPath = '/v4/breaking_changes'
const newPath = `/${nonEnterpriseDefaultVersion}/graphql/overview/breaking-changes`
const newPath = `/graphql/overview/breaking-changes`
const res = await get(oldPath)
expect(res.statusCode).toBe(301)
expect(res.headers.location).toBe(`/en${newPath}`)
@ -44,19 +45,19 @@ describe('developer redirects', () => {
const enterpriseRes = await get(`/enterprise${oldPath}`, { followAllRedirects: true })
expect(enterpriseRes.statusCode).toBe(200)
const finalPath = (new URL(enterpriseRes.request.url)).pathname
const expectedFinalPath = newPath.replace(nonEnterpriseDefaultVersion, `enterprise-server@${enterpriseServerReleases.latest}`)
const expectedFinalPath = path.join('/', `enterprise-server@${enterpriseServerReleases.latest}`, newPath)
expect(finalPath).toBe(`/en${expectedFinalPath}`)
})
test('graphql reference paths with child pages', async () => {
const sclarRes = await get('/en/v4/scalar/boolean')
expect(sclarRes.statusCode).toBe(301)
const sclarResFinalPath = `/en/${nonEnterpriseDefaultVersion}/graphql/reference/scalars#boolean`
const sclarResFinalPath = `/en/graphql/reference/scalars#boolean`
expect(sclarRes.headers.location).toBe(sclarResFinalPath)
const enumRes = await get('/en/v4/enum/searchtype')
expect(enumRes.statusCode).toBe(301)
const enumResFinalPath = `/en/${nonEnterpriseDefaultVersion}/graphql/reference/enums#searchtype`
const enumResFinalPath = `/en/graphql/reference/enums#searchtype`
expect(enumRes.headers.location).toBe(enumResFinalPath)
})
})
@ -65,21 +66,21 @@ describe('developer redirects', () => {
let expectedFinalPath
let res = await get('/v3')
expect(res.statusCode).toBe(301)
expectedFinalPath = `/en/${nonEnterpriseDefaultVersion}/rest`
expectedFinalPath = `/en/rest`
expect(res.headers.location).toBe(expectedFinalPath)
// REST subresources like activity notifications don't have their own page
// any more, so redirect to an anchor on the resource page
res = await get('/en/v3/activity')
expect(res.statusCode).toBe(301)
expectedFinalPath = `/en/${nonEnterpriseDefaultVersion}/rest/reference/activity`
expectedFinalPath = `/en/rest/reference/activity`
expect(res.headers.location).toBe(expectedFinalPath)
// REST subresources like activity notifications don't have their own page
// any more, so redirect to an anchor on the resource page
res = await get('/en/v3/activity/notifications')
expect(res.statusCode).toBe(301)
expectedFinalPath = `/en/${nonEnterpriseDefaultVersion}/rest/reference/activity#notifications`
expectedFinalPath = `/en/rest/reference/activity#notifications`
expect(res.headers.location).toBe(expectedFinalPath)
// trailing slashes are handled separately by the `slashes` module;
@ -91,7 +92,7 @@ describe('developer redirects', () => {
// non-reference redirects (e.g. guides)
res = await get('/en/v3/guides/basics-of-authentication')
expect(res.statusCode).toBe(301)
expectedFinalPath = `/en/${nonEnterpriseDefaultVersion}/rest/guides/basics-of-authentication`
expectedFinalPath = `/en/rest/guides/basics-of-authentication`
expect(res.headers.location).toBe(expectedFinalPath)
})

Просмотреть файл

@ -34,10 +34,12 @@ describe('redirects', () => {
languageCode: 'en'
})
page.buildRedirects()
expect(page.redirects['/articles']).toBe(`/en/${nonEnterpriseDefaultVersion}/github`)
expect(page.redirects['/en/articles']).toBe(`/en/${nonEnterpriseDefaultVersion}/github`)
expect(page.redirects['/common-issues-and-questions']).toBe(`/en/${nonEnterpriseDefaultVersion}/github`)
expect(page.redirects['/en/common-issues-and-questions']).toBe(`/en/${nonEnterpriseDefaultVersion}/github`)
expect(page.redirects[`/en/${nonEnterpriseDefaultVersion}/github`]).toBe('/en/github')
expect(page.redirects['/articles']).toBe('/en/github')
expect(page.redirects['/en/articles']).toBe(`/en/github`)
expect(page.redirects[`/en/${nonEnterpriseDefaultVersion}/articles`]).toBe('/en/github')
expect(page.redirects['/common-issues-and-questions']).toBe('/en/github')
expect(page.redirects['/en/common-issues-and-questions']).toBe('/en/github')
expect(page.redirects[`/en/enterprise/${enterpriseServerReleases.latest}/user/articles`]).toBe(`/en/enterprise-server@${enterpriseServerReleases.latest}/github`)
expect(page.redirects[`/en/enterprise/${enterpriseServerReleases.latest}/user/common-issues-and-questions`]).toBe(`/en/enterprise-server@${enterpriseServerReleases.latest}/github`)
})
@ -49,7 +51,7 @@ describe('redirects', () => {
languageCode: 'en'
})
page.buildRedirects()
const expected = `/en/${nonEnterpriseDefaultVersion}/github/collaborating-with-issues-and-pull-requests/about-conversations-on-github`
const expected = `/en/github/collaborating-with-issues-and-pull-requests/about-conversations-on-github`
expect(page.redirects['/en/articles/about-discussions-in-issues-and-pull-requests']).toBe(expected)
})
@ -125,7 +127,7 @@ describe('redirects', () => {
test('redirect_from for renamed pages', async () => {
const { res } = await get('/ja/desktop/contributing-to-projects/changing-a-remote-s-url-from-github-desktop')
expect(res.statusCode).toBe(301)
const expected = `/ja/${nonEnterpriseDefaultVersion}/desktop/contributing-and-collaborating-using-github-desktop/changing-a-remotes-url-from-github-desktop`
const expected = `/ja/desktop/contributing-and-collaborating-using-github-desktop/changing-a-remotes-url-from-github-desktop`
expect(res.headers.location).toBe(expected)
})
})
@ -332,7 +334,7 @@ describe('redirects', () => {
})
describe('desktop guide', () => {
const desktopGuide = `/en/${nonEnterpriseDefaultVersion}/desktop/contributing-and-collaborating-using-github-desktop/creating-an-issue-or-pull-request`
const desktopGuide = `/en/desktop/contributing-and-collaborating-using-github-desktop/creating-an-issue-or-pull-request`
const japaneseDesktopGuides = desktopGuide.replace('/en/', '/ja/')
test('no language code redirects to english', async () => {

Просмотреть файл

@ -57,7 +57,7 @@ describe('liquid helper tags', () => {
test('link_with_intro tag', async () => {
const template = '{% link_with_intro /contributing-and-collaborating-using-github-desktop %}'
const page = pageMap[`/en/${nonEnterpriseDefaultVersion}/desktop/contributing-and-collaborating-using-github-desktop`]
const page = pageMap[`/en/desktop/contributing-and-collaborating-using-github-desktop`]
const expected = `<a class="link-with-intro Bump-link--hover no-underline" href="/en/desktop/contributing-and-collaborating-using-github-desktop">
<h2 class="link-with-intro-title f4">${page.title}<span class="Bump-link-symbol"></span></h2>
</a>
@ -68,7 +68,7 @@ describe('liquid helper tags', () => {
test('homepage_link_with_intro tag', async () => {
const template = '{% homepage_link_with_intro /github/writing-on-github/basic-writing-and-formatting-syntax %}'
const page = pageMap[`/en/${nonEnterpriseDefaultVersion}/github/writing-on-github/basic-writing-and-formatting-syntax`]
const page = pageMap[`/en/github/writing-on-github/basic-writing-and-formatting-syntax`]
const expected = `<a class="link-with-intro Bump-link--hover no-underline d-block offset-lg-2 col-lg-8 mb-5" href="/en/github/writing-on-github/basic-writing-and-formatting-syntax">
<h4 class="link-with-intro-title h4-mktg">${page.title}<span class="Bump-link-symbol"></span></h4>
<p class="link-with-intro-intro f5">${page.intro}</p>

Просмотреть файл

@ -86,8 +86,8 @@ describe('Page class', () => {
test('rewrites links to include the current language prefix and version', async () => {
const page = await Page.init(opts)
const context = {
page: { version: nonEnterpriseDefaultVersion },
currentVersion: nonEnterpriseDefaultVersion,
page: { version: `enterprise-server@${enterpriseServerReleases.latest}` },
currentVersion: `enterprise-server@${enterpriseServerReleases.latest}`,
currentPath: '/en/github/collaborating-with-issues-and-pull-requests/about-branches',
currentLanguage: 'en'
}
@ -96,14 +96,14 @@ describe('Page class', () => {
expect(page.markdown.includes('(/articles/about-pull-requests)')).toBe(true)
expect(page.markdown.includes('(/en/articles/about-pull-requests)')).toBe(false)
expect($('a[href="/articles/about-pull-requests"]').length).toBe(0)
expect($(`a[href="/en/${nonEnterpriseDefaultVersion}/articles/about-pull-requests"]`).length).toBeGreaterThan(0)
expect($(`a[href="/en/${`enterprise-server@${enterpriseServerReleases.latest}`}/articles/about-pull-requests"]`).length).toBeGreaterThan(0)
})
test('rewrites links on prerendered GraphQL page include the current language prefix and version', async () => {
const graphqlVersion = allVersions[nonEnterpriseDefaultVersion].miscVersionName
const graphqlVersion = allVersions[`enterprise-server@${enterpriseServerReleases.latest}`].miscVersionName
const $ = cheerio.load(prerenderedObjects[graphqlVersion].html)
expect($('a[href^="/graphql/reference/input-objects"]').length).toBe(0)
expect($(`a[href^="/en/${nonEnterpriseDefaultVersion}/graphql/reference/input-objects"]`).length).toBeGreaterThan(0)
expect($(`a[href^="/en/enterprise-server@${enterpriseServerReleases.latest}/graphql/reference/input-objects"]`).length).toBeGreaterThan(0)
})
test('rewrites links in the intro to include the current language prefix and version', async () => {
@ -118,7 +118,7 @@ describe('Page class', () => {
await page.render(context)
const $ = cheerio.load(page.intro)
expect($('a[href="/articles/about-pull-requests"]').length).toBe(0)
expect($(`a[href="/en/${nonEnterpriseDefaultVersion}/articles/about-pull-requests"]`).length).toBeGreaterThan(0)
expect($(`a[href="/en/articles/about-pull-requests"]`).length).toBeGreaterThan(0)
})
test('does not rewrite links that include deprecated enterprise release numbers', async () => {
@ -235,7 +235,7 @@ describe('Page class', () => {
test('sets versioned values', async () => {
const page = await Page.init(opts)
expect(page.permalinks.find(permalink => permalink.pageVersion === nonEnterpriseDefaultVersion).href).toBe(`/en/${nonEnterpriseDefaultVersion}/github/collaborating-with-issues-and-pull-requests/about-branches`)
expect(page.permalinks.find(permalink => permalink.pageVersion === nonEnterpriseDefaultVersion).href).toBe(`/en/github/collaborating-with-issues-and-pull-requests/about-branches`)
expect(page.permalinks.find(permalink => permalink.pageVersion === `enterprise-server@${enterpriseServerReleases.oldestSupported}`).href).toBe(`/en/enterprise-server@${enterpriseServerReleases.oldestSupported}/github/collaborating-with-issues-and-pull-requests/about-branches`)
})
@ -245,9 +245,8 @@ describe('Page class', () => {
basePath: path.join(__dirname, '../../content'),
languageCode: 'en'
})
expect(page.permalinks.find(permalink => permalink.pageVersion === nonEnterpriseDefaultVersion).href).toBe(`/en/${nonEnterpriseDefaultVersion}`)
expect(page.permalinks.find(permalink => permalink.pageVersion === 'homepage').href).toBe(`/en`)
expect(page.permalinks.find(permalink => permalink.pageVersion === `enterprise-server@${enterpriseServerReleases.oldestSupported}`).href).toBe(`/en/enterprise-server@${enterpriseServerReleases.oldestSupported}`)
expect(page.permalinks.find(permalink => permalink.pageVersion === 'homepage').href).toBe('/en')
})
test('permalinks for dotcom-only pages', async () => {
@ -256,7 +255,7 @@ describe('Page class', () => {
basePath: path.join(__dirname, '../../content'),
languageCode: 'en'
})
expect(page.permalinks.find(permalink => permalink.pageVersion === nonEnterpriseDefaultVersion).href).toBe(`/en/${nonEnterpriseDefaultVersion}/github/getting-started-with-github/signing-up-for-a-new-github-account`)
expect(page.permalinks.find(permalink => permalink.pageVersion === nonEnterpriseDefaultVersion).href).toBe(`/en/github/getting-started-with-github/signing-up-for-a-new-github-account`)
expect(page.permalinks.length).toBe(1)
})
@ -278,7 +277,7 @@ describe('Page class', () => {
basePath: path.join(__dirname, '../fixtures'),
languageCode: 'en'
})
expect(page.permalinks.find(permalink => permalink.pageVersion === nonEnterpriseDefaultVersion).href).toBe(`/en/${nonEnterpriseDefaultVersion}/products/actions/some-category/some-article`)
expect(page.permalinks.find(permalink => permalink.pageVersion === nonEnterpriseDefaultVersion).href).toBe(`/en/products/actions/some-category/some-article`)
expect(page.permalinks.length).toBe(1)
})

Просмотреть файл

@ -20,8 +20,8 @@ describe('Permalink class', () => {
test('derives info for non-enterprise versioned homepage', () => {
const permalink = new Permalink('en', nonEnterpriseDefaultVersion, 'index.md', 'Hello World')
expect(permalink.pageVersionTitle).toBe('Free, Pro, and Team')
expect(permalink.href).toBe(`/en/${nonEnterpriseDefaultVersion}`)
expect(permalink.pageVersionTitle).toBe('GitHub.com')
expect(permalink.href).toBe(`/en`)
})
test('derives info for enterprise server versioned homepage', () => {
@ -32,8 +32,8 @@ describe('Permalink class', () => {
test('derives info for GitHub.com homepage', () => {
const permalink = new Permalink('en', nonEnterpriseDefaultVersion, 'github/index.md', 'Hello World')
expect(permalink.pageVersionTitle).toBe('Free, Pro, and Team')
expect(permalink.href).toBe(`/en/${nonEnterpriseDefaultVersion}/github`)
expect(permalink.pageVersionTitle).toBe('GitHub.com')
expect(permalink.href).toBe(`/en/github`)
})
test('derives info for enterprise version of GitHub.com homepage', () => {

Просмотреть файл

@ -33,7 +33,7 @@ describe('versions middleware', () => {
expect(currentVersion).toBe('homepage')
currentVersion = await getJSON(`/en/${nonEnterpriseDefaultVersion}?json=currentVersion`)
expect(currentVersion).toBe(nonEnterpriseDefaultVersion)
expect(currentVersion).toBe('homepage')
currentVersion = await getJSON(`/en/enterprise-server@${latest}?json=currentVersion`)
expect(currentVersion).toBe(`enterprise-server@${latest}`)