test(aio): improve test description and expectations
This commit is contained in:
parent
17f5f3b32c
commit
0c5f893f6e
@ -127,12 +127,14 @@ 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 bodyRegex = new RegExp(`^PR: ${pr} | SHA: ${sha0} | File: /index\\.html$`);
|
const bodyRegex9 = new RegExp(`^PR: ${pr} | SHA: ${sha9} | File: /index\\.html$`);
|
||||||
|
const bodyRegex0 = new RegExp(`^PR: ${pr} | SHA: ${sha0} | File: /index\\.html$`);
|
||||||
|
|
||||||
Promise.all([
|
Promise.all([
|
||||||
h.runCmd(`curl -iL ${scheme}://pr${pr}-0${sha9}.${host}`).then(h.verifyResponse(404)),
|
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);
|
]).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 cmdPrefix = `curl -iLX POST ${scheme}://${host}/create-build/${pr}`;
|
||||||
const bodyRegex = /Missing or empty 'AUTHORIZATION' header/;
|
const bodyRegex = /Missing or empty 'AUTHORIZATION' header/;
|
||||||
|
|
||||||
|
@ -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([
|
Promise.all([
|
||||||
h.runCmd(`${curl} http://${host}/create-build/${pr}/0${sha9}`).then(h.verifyResponse(404)),
|
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)),
|
h.runCmd(`${curl} http://${host}/create-build/${pr}/${sha0}`).then(h.verifyResponse(500)),
|
||||||
]).then(done);
|
]).then(done);
|
||||||
});
|
});
|
||||||
|
@ -323,18 +323,16 @@ describe('uploadServerFactory', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
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 sha41 = '0'.repeat(41);
|
|
||||||
const sha40 = '0'.repeat(40);
|
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}`).
|
const request41 = agent.get(`/create-build/${pr}/${sha41}`).set('AUTHORIZATION', 'baz').set('X-FILE', 'qux');
|
||||||
set('AUTHORIZATION', 'foo').
|
|
||||||
set('X-FILE', 'bar');
|
|
||||||
|
|
||||||
Promise.all([
|
Promise.all([
|
||||||
promisifyRequest(request41.expect(404)),
|
|
||||||
promisifyRequest(request40.expect(201)),
|
promisifyRequest(request40.expect(201)),
|
||||||
|
promisifyRequest(request41.expect(404)),
|
||||||
]).then(done, done.fail);
|
]).then(done, done.fail);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user