Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahs committed Nov 17, 2020
1 parent 24af9b3 commit a895ef6
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions tests/routing/deprecated-enterprise-versions.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,11 @@ describe('deprecation banner', () => {

test('deprecation warning banner says "will be discontinued" when date is in future', async () => {
const $ = await getDOM(`/en/enterprise/${enterpriseServerReleases.oldestSupported}`)
expect($('.deprecation-banner b').text().includes('will be discontinued')).toBe(true)
if (enterpriseServerReleases.isOldestReleaseDeprecated) {
expect($('.deprecation-banner b').text().includes('was discontinued')).toBe(true)
} else {
expect($('.deprecation-banner b').text().includes('will be discontinued')).toBe(true)
}
})

test('deprecation warning banner says "was discontinued" when date is in past', async () => {
Expand All @@ -98,17 +102,25 @@ describe('deprecation banner', () => {

describe('does not render helpfulness prompt or contribution button', () => {
test('does not render helpfulness prompt', async () => {
let $ = await getDOM(`/en/enterprise/${enterpriseServerReleases.oldestSupported}/github`)
expect($('.js-helpfulness').length).toBe(0)
$ = await getDOM(`/en/enterprise/${enterpriseServerReleases.latest}/github`)
let $ = await getDOM(`/en/enterprise/${enterpriseServerReleases.latest}/github`)
expect($('.js-helpfulness').length).toBeGreaterThan(0)
$ = await getDOM(`/en/enterprise/${enterpriseServerReleases.oldestSupported}/github`)
if (enterpriseServerReleases.isOldestReleaseDeprecated) {
expect($('.js-helpfulness').length).toBe(0)
} else {
expect($('.js-helpfulness').length).toBeGreaterThan(0)
}
})

test('does not render contribution button', async () => {
let $ = await getDOM(`/en/enterprise/${enterpriseServerReleases.oldestSupported}/github`)
expect($('.contribution').length).toBe(0)
$ = await getDOM(`/en/enterprise/${enterpriseServerReleases.latest}/github`)
let $ = await getDOM(`/en/enterprise/${enterpriseServerReleases.latest}/github`)
expect($('.contribution').length).toBeGreaterThan(0)
$ = await getDOM(`/en/enterprise/${enterpriseServerReleases.oldestSupported}/github`)
if (enterpriseServerReleases.isOldestReleaseDeprecated) {
expect($('.contribution').length).toBe(0)
} else {
expect($('.js-helpfulness').length).toBeGreaterThan(0)
}
})
})

Expand Down

0 comments on commit a895ef6

Please sign in to comment.