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

updating with headers within the opts and adding 3 tests to cover en and chinese

This commit is contained in:
Grace Park
2021-05-25 21:12:33 -07:00
parent 82e9247d95
commit 6a321c29e3
2 changed files with 23 additions and 4 deletions

View File

@@ -68,6 +68,25 @@ describe('header', () => {
expect($('.header-notifications.translation_notice').length).toBe(1)
expect($('.header-notifications a[href*="/ja"]').length).toBe(1)
})
test('renders a link to the same page if user\'s preferred language is Chinese - PRC', async () => {
const headers = { 'accept-language': 'zh-CN' }
const $ = await getDOM('/en', headers)
expect($('.header-notifications.translation_notice').length).toBe(1)
expect($('.header-notifications a[href*="/cn"]').length).toBe(1)
})
test('does not render a link when user\s preferred language is Chinese - Taiwan', async () => {
const headers = { 'accept-language': 'zh-TW' }
const $ = await getDOM('/en', headers)
expect($('.header-notifications').length).toBe(0)
})
test('does not render a link when user\s preferred language is English', async () => {
const headers = { 'accept-language': 'en' }
const $ = await getDOM('/en', headers)
expect($('.header-notifications').length).toBe(0)
})
})
describe('mobile-only product dropdown links', () => {