2019-09-05 15:15:27 +00:00
|
|
|
import { getPort, loadFixture, Nuxt, rp } from '../utils'
|
2019-03-20 16:46:09 +00:00
|
|
|
|
|
|
|
let port
|
2019-09-05 15:15:27 +00:00
|
|
|
const url = route => 'http://localhost:' + port + encodeURI(route)
|
2019-03-20 16:46:09 +00:00
|
|
|
|
|
|
|
let nuxt = null
|
|
|
|
|
2020-11-30 22:10:02 +00:00
|
|
|
describe('encoding', () => {
|
2019-03-20 16:46:09 +00:00
|
|
|
beforeAll(async () => {
|
2020-11-30 22:10:02 +00:00
|
|
|
const config = await loadFixture('encoding')
|
2019-03-20 16:46:09 +00:00
|
|
|
nuxt = new Nuxt(config)
|
|
|
|
await nuxt.ready()
|
|
|
|
|
|
|
|
port = await getPort()
|
|
|
|
await nuxt.server.listen(port, 'localhost')
|
|
|
|
})
|
|
|
|
|
|
|
|
test('/ö/ (router base)', async () => {
|
2019-12-02 15:23:56 +00:00
|
|
|
const { body: response } = await rp(url('/ö/'))
|
2019-03-20 16:46:09 +00:00
|
|
|
|
2020-11-30 22:10:02 +00:00
|
|
|
expect(response).toContain('Unicode base works!')
|
2019-03-20 16:46:09 +00:00
|
|
|
})
|
|
|
|
|
2020-12-06 17:32:39 +00:00
|
|
|
test('/ö/dynamic?q=food,coffee (encodeURIComponent)', async () => {
|
|
|
|
const { body: response } = await rp(url('/ö/dynamic?q=food%252Ccoffee'))
|
|
|
|
|
|
|
|
expect(response).toContain('food,coffee')
|
|
|
|
})
|
|
|
|
|
|
|
|
test('/ö/@about', async () => {
|
|
|
|
const { body: response } = await rp(url('/ö/@about'))
|
|
|
|
|
|
|
|
expect(response).toContain('About')
|
|
|
|
})
|
|
|
|
|
2019-03-20 16:46:09 +00:00
|
|
|
// Close server and ask nuxt to stop listening to file changes
|
|
|
|
afterAll(async () => {
|
|
|
|
await nuxt.close()
|
|
|
|
})
|
|
|
|
})
|