From 995b62e17992f2e30e3892ad76e94064f2b4a63b Mon Sep 17 00:00:00 2001 From: Joe Haddad Date: Thu, 26 Mar 2020 12:30:25 -0400 Subject: [PATCH] Test `static/` file name encoding --- .../dynamic-routing/static/hello copy.txt | 1 + .../dynamic-routing/static/hello%20copy.txt | 1 + .../dynamic-routing/static/hello+copy.txt | 1 + .../dynamic-routing/static/hello.txt | 1 + .../dynamic-routing/test/index.test.js | 28 +++++++++++++++++++ 5 files changed, 32 insertions(+) create mode 100644 test/integration/dynamic-routing/static/hello copy.txt create mode 100644 test/integration/dynamic-routing/static/hello%20copy.txt create mode 100644 test/integration/dynamic-routing/static/hello+copy.txt create mode 100644 test/integration/dynamic-routing/static/hello.txt diff --git a/test/integration/dynamic-routing/static/hello copy.txt b/test/integration/dynamic-routing/static/hello copy.txt new file mode 100644 index 00000000000000..48941bc083e7e7 --- /dev/null +++ b/test/integration/dynamic-routing/static/hello copy.txt @@ -0,0 +1 @@ +hello world copy \ No newline at end of file diff --git a/test/integration/dynamic-routing/static/hello%20copy.txt b/test/integration/dynamic-routing/static/hello%20copy.txt new file mode 100644 index 00000000000000..c619e3b1f68fbf --- /dev/null +++ b/test/integration/dynamic-routing/static/hello%20copy.txt @@ -0,0 +1 @@ +hello world %20 \ No newline at end of file diff --git a/test/integration/dynamic-routing/static/hello+copy.txt b/test/integration/dynamic-routing/static/hello+copy.txt new file mode 100644 index 00000000000000..2c6733445659c9 --- /dev/null +++ b/test/integration/dynamic-routing/static/hello+copy.txt @@ -0,0 +1 @@ +hello world + \ No newline at end of file diff --git a/test/integration/dynamic-routing/static/hello.txt b/test/integration/dynamic-routing/static/hello.txt new file mode 100644 index 00000000000000..95d09f2b101593 --- /dev/null +++ b/test/integration/dynamic-routing/static/hello.txt @@ -0,0 +1 @@ +hello world \ No newline at end of file diff --git a/test/integration/dynamic-routing/test/index.test.js b/test/integration/dynamic-routing/test/index.test.js index 4c73f4430f5507..72f44167617c68 100644 --- a/test/integration/dynamic-routing/test/index.test.js +++ b/test/integration/dynamic-routing/test/index.test.js @@ -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')