Skip to content

Commit

Permalink
Test static/ file name encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
Timer committed Mar 26, 2020
1 parent e83cd4a commit 995b62e
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/integration/dynamic-routing/static/hello copy.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hello world copy
1 change: 1 addition & 0 deletions test/integration/dynamic-routing/static/hello%20copy.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hello world %20
1 change: 1 addition & 0 deletions test/integration/dynamic-routing/static/hello+copy.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hello world +
1 change: 1 addition & 0 deletions test/integration/dynamic-routing/static/hello.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hello world
28 changes: 28 additions & 0 deletions test/integration/dynamic-routing/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,34 @@ function runTests(dev) {
expect(res.status).toBe(200)
})

it('should serve file with space from static folder', async () => {
const res = await fetchViaHTTP(appPort, '/static/hello copy.txt')
const text = (await res.text()).trim()
expect(text).toBe('hello world copy')
expect(res.status).toBe(200)
})

it('should serve file with plus from static folder', async () => {
const res = await fetchViaHTTP(appPort, '/static/hello+copy.txt')
const text = (await res.text()).trim()
expect(text).toBe('hello world +')
expect(res.status).toBe(200)
})

it('should serve file from static folder encoded', async () => {
const res = await fetchViaHTTP(appPort, '/static/hello%20copy.txt')
const text = (await res.text()).trim()
expect(text).toBe('hello world copy')
expect(res.status).toBe(200)
})

it('should serve file with %20 from static folder', async () => {
const res = await fetchViaHTTP(appPort, '/static/hello%2520copy.txt')
const text = (await res.text()).trim()
expect(text).toBe('hello world %20')
expect(res.status).toBe(200)
})

if (dev) {
it('should work with HMR correctly', async () => {
const browser = await webdriver(appPort, '/post-1/comments')
Expand Down

0 comments on commit 995b62e

Please sign in to comment.