forked from github/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlanguage-code-redirects.js
More file actions
27 lines (22 loc) · 960 Bytes
/
Copy pathlanguage-code-redirects.js
File metadata and controls
27 lines (22 loc) · 960 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
const { get } = require('../helpers')
describe('language code redirects', () => {
jest.setTimeout(5 * 60 * 1000)
test('redirects accidental /jp* requests to /ja*', async () => {
let $
$ = await get('/jp', { dom: false })
expect($.res.statusCode).toBe(301)
expect($.res.headers.location).toBe('/ja')
$ = await get('/jp/articles/about-your-personal-dashboard', { dom: false })
expect($.res.statusCode).toBe(301)
expect($.res.headers.location).toBe('/ja/articles/about-your-personal-dashboard')
})
test('redirects accidental /zh-CN* requests to /cn*', async () => {
let $
$ = await get('/zh-CN', { dom: false })
expect($.res.statusCode).toBe(301)
expect($.res.headers.location).toBe('/cn')
$ = await get('/zh-TW/articles/about-your-personal-dashboard', { dom: false })
expect($.res.statusCode).toBe(301)
expect($.res.headers.location).toBe('/cn/articles/about-your-personal-dashboard')
})
})