Skip to content

Commit

Permalink
Adjust tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Timer committed Dec 11, 2019
1 parent 0d3a4e5 commit 69cfd33
Showing 1 changed file with 33 additions and 2 deletions.
35 changes: 33 additions & 2 deletions test/integration/public-dir/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
startApp,
stopApp,
renderViaHTTP,
fetchViaHTTP,
} from 'next-test-utils'

const appDir = join(__dirname, '../')
Expand Down Expand Up @@ -41,13 +42,43 @@ describe('Public Files', () => {
expect(html).toMatch(/i have a plus/)
})

it('should not stream the file + with trailing slash', async () => {
const res = await fetchViaHTTP(appPort, `/test+this.txt/`)
expect(res.status).toBe(404)
})

it('should not stream the file + encoded', async () => {
const res = await fetchViaHTTP(
appPort,
`/test${encodeURIComponent('+')}this.txt`
)
expect(res.status).toBe(404)
})

it('should stream the file :', async () => {
const html = await renderViaHTTP(appPort, '/test:this.txt')
expect(html).toMatch(/i have a :/)
})

it('should stream the file space', async () => {
const html = await renderViaHTTP(appPort, '/test this.txt')
it('should not stream the file : encoded', async () => {
const res = await fetchViaHTTP(
appPort,
`/test${encodeURIComponent(':')}this.txt`
)
expect(res.status).toBe(404)
})

xit('should stream the file space', async () => {
const html = await renderViaHTTP(appPort, '/test space.txt')
expect(html).toMatch(/i have a space/)
})

// Why is this one different? %20 is `encodeURI`.
xit('should stream the file space encoded', async () => {
const html = await renderViaHTTP(
appPort,
`/test${encodeURIComponent(' ')}space.txt`
)
expect(html).toMatch(/i have a space/)
})
})
Expand Down

0 comments on commit 69cfd33

Please sign in to comment.