1
0
mirror of synced 2025-12-25 02:17:36 -05:00

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
parent 374112c55f
commit affbc80a3c
15 changed files with 258 additions and 256 deletions

View File

@@ -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'
}
}

View File

@@ -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)
})
})
})

View File

@@ -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')

View File

@@ -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)