diff --git a/aio/aio-builds-setup/dockerbuild/scripts-js/lib/verify-setup/nginx.e2e.ts b/aio/aio-builds-setup/dockerbuild/scripts-js/lib/verify-setup/nginx.e2e.ts index 7c28b9e09b..99959c2e44 100644 --- a/aio/aio-builds-setup/dockerbuild/scripts-js/lib/verify-setup/nginx.e2e.ts +++ b/aio/aio-builds-setup/dockerbuild/scripts-js/lib/verify-setup/nginx.e2e.ts @@ -127,12 +127,14 @@ describe(`nginx`, () => { }); - it('should accept SHAs with leading zeros (but not ignore them)', done => { - const bodyRegex = new RegExp(`^PR: ${pr} | SHA: ${sha0} | File: /index\\.html$`); + it('should accept SHAs with leading zeros (but not trim the zeros)', done => { + const bodyRegex9 = new RegExp(`^PR: ${pr} | SHA: ${sha9} | File: /index\\.html$`); + const bodyRegex0 = new RegExp(`^PR: ${pr} | SHA: ${sha0} | File: /index\\.html$`); Promise.all([ h.runCmd(`curl -iL ${scheme}://pr${pr}-0${sha9}.${host}`).then(h.verifyResponse(404)), - h.runCmd(`curl -iL ${scheme}://pr${pr}-${sha0}.${host}`).then(h.verifyResponse(200, bodyRegex)), + h.runCmd(`curl -iL ${scheme}://pr${pr}-${sha9}.${host}`).then(h.verifyResponse(200, bodyRegex9)), + h.runCmd(`curl -iL ${scheme}://pr${pr}-${sha0}.${host}`).then(h.verifyResponse(200, bodyRegex0)), ]).then(done); }); @@ -229,7 +231,7 @@ describe(`nginx`, () => { }); - it('should accept SHAs with leading zeros (but not ignore them)', done => { + it('should accept SHAs with leading zeros (but not trim the zeros)', done => { const cmdPrefix = `curl -iLX POST ${scheme}://${host}/create-build/${pr}`; const bodyRegex = /Missing or empty 'AUTHORIZATION' header/; diff --git a/aio/aio-builds-setup/dockerbuild/scripts-js/lib/verify-setup/upload-server.e2e.ts b/aio/aio-builds-setup/dockerbuild/scripts-js/lib/verify-setup/upload-server.e2e.ts index 627d4dd766..84ea36d8f7 100644 --- a/aio/aio-builds-setup/dockerbuild/scripts-js/lib/verify-setup/upload-server.e2e.ts +++ b/aio/aio-builds-setup/dockerbuild/scripts-js/lib/verify-setup/upload-server.e2e.ts @@ -84,9 +84,10 @@ describe('upload-server (on HTTP)', () => { }); - it('should accept SHAs with leading zeros (but not ignore them)', done => { + it('should accept SHAs with leading zeros (but not trim the zeros)', done => { Promise.all([ h.runCmd(`${curl} http://${host}/create-build/${pr}/0${sha9}`).then(h.verifyResponse(404)), + h.runCmd(`${curl} http://${host}/create-build/${pr}/${sha9}`).then(h.verifyResponse(500)), h.runCmd(`${curl} http://${host}/create-build/${pr}/${sha0}`).then(h.verifyResponse(500)), ]).then(done); }); diff --git a/aio/aio-builds-setup/dockerbuild/scripts-js/test/upload-server/upload-server-factory.spec.ts b/aio/aio-builds-setup/dockerbuild/scripts-js/test/upload-server/upload-server-factory.spec.ts index dfaf1d4d6a..3784b747a2 100644 --- a/aio/aio-builds-setup/dockerbuild/scripts-js/test/upload-server/upload-server-factory.spec.ts +++ b/aio/aio-builds-setup/dockerbuild/scripts-js/test/upload-server/upload-server-factory.spec.ts @@ -323,18 +323,16 @@ describe('uploadServerFactory', () => { }); - it('should accept SHAs with leading zeros (but not ignore them)', done => { - const sha41 = '0'.repeat(41); + it('should accept SHAs with leading zeros (but not trim the zeros)', done => { const sha40 = '0'.repeat(40); + const sha41 = `0${sha40}`; - const request41 = agent.get(`/create-build/${pr}/${sha41}`); - const request40 = agent.get(`/create-build/${pr}/${sha40}`). - set('AUTHORIZATION', 'foo'). - set('X-FILE', 'bar'); + const request40 = agent.get(`/create-build/${pr}/${sha40}`).set('AUTHORIZATION', 'foo').set('X-FILE', 'bar'); + const request41 = agent.get(`/create-build/${pr}/${sha41}`).set('AUTHORIZATION', 'baz').set('X-FILE', 'qux'); Promise.all([ - promisifyRequest(request41.expect(404)), promisifyRequest(request40.expect(201)), + promisifyRequest(request41.expect(404)), ]).then(done, done.fail); });