mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-22 00:16:15 -04:00
add test for duplicate query parameters; return 400 instead of 500 on some errors
This commit is contained in:
parent
5efaa97f4e
commit
36a8f163cf
4 changed files with 66 additions and 37 deletions
|
@ -144,11 +144,11 @@ describe(__filename, function () {
|
|||
const missingCallbackKnownFile = '/javascripts/lib/ep_etherpad-lite/static/js/ace2_inner.js';
|
||||
await agent.get(missingCallbackUnknownFile)
|
||||
.then((res) => {
|
||||
assert.equal(res.statusCode, 500);
|
||||
assert.equal(res.statusCode, 400);
|
||||
});
|
||||
await agent.get(missingCallbackKnownFile)
|
||||
.then((res) => {
|
||||
assert.equal(res.statusCode, 500);
|
||||
assert.equal(res.statusCode, 400);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -161,7 +161,7 @@ describe(__filename, function () {
|
|||
});
|
||||
await agent.get(vQueryWrong)
|
||||
.then((res) => {
|
||||
assert.equal(res.statusCode, 500);
|
||||
assert.equal(res.statusCode, 400);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -172,7 +172,19 @@ describe(__filename, function () {
|
|||
await Promise.all(notAllowed.map(async (resource) =>
|
||||
await agent.get(resource)
|
||||
.then((res) => {
|
||||
assert.equal(res.statusCode, 500)
|
||||
assert.equal(res.statusCode, 400)
|
||||
})
|
||||
));
|
||||
});
|
||||
|
||||
it('a parameter is not allowed to appear more than once', async function() {
|
||||
const notAllowed = [ `/javascripts/lib/ep_etherpad-lite/static/js/ace2_inner.js?callback=require.define&v=${settings.randomVersionString}&v=${settings.randomVersionString}`,
|
||||
`/javascripts/lib/ep_etherpad-lite/static/js/ace2_inner.js?callback=require.define&v=${settings.randomVersionString}&callback=require.define`,
|
||||
]
|
||||
await Promise.all(notAllowed.map(async (resource) =>
|
||||
await agent.get(resource)
|
||||
.then((res) => {
|
||||
assert.equal(res.statusCode, 400)
|
||||
})
|
||||
));
|
||||
});
|
||||
|
@ -301,11 +313,11 @@ describe(__filename, function () {
|
|||
const missingCallbackKnownFile = '/javascripts/lib/ep_etherpad-lite/static/js/ace2_inner.js';
|
||||
await agent.get(missingCallbackUnknownFile)
|
||||
.then((res) => {
|
||||
assert.equal(res.statusCode, 500);
|
||||
assert.equal(res.statusCode, 400);
|
||||
});
|
||||
await agent.get(missingCallbackKnownFile)
|
||||
.then((res) => {
|
||||
assert.equal(res.statusCode, 500);
|
||||
assert.equal(res.statusCode, 400);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -318,7 +330,7 @@ describe(__filename, function () {
|
|||
});
|
||||
await agent.get(vQueryWrong)
|
||||
.then((res) => {
|
||||
assert.equal(res.statusCode, 500);
|
||||
assert.equal(res.statusCode, 400);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -328,10 +340,22 @@ describe(__filename, function () {
|
|||
]
|
||||
await Promise.all(notAllowed.map(async (resource) => await agent.get(resource)
|
||||
.then((res) => {
|
||||
assert.equal(res.statusCode, 500)
|
||||
assert.equal(res.statusCode, 400)
|
||||
})));
|
||||
});
|
||||
|
||||
it('a parameter is not allowed to appear more than once', async function() {
|
||||
const notAllowed = [ `/javascripts/lib/ep_etherpad-lite/static/js/ace2_inner.js?callback=require.define&v=${settings.randomVersionString}&v=${settings.randomVersionString}`,
|
||||
`/javascripts/lib/ep_etherpad-lite/static/js/ace2_inner.js?callback=require.define&v=${settings.randomVersionString}&callback=require.define`,
|
||||
]
|
||||
await Promise.all(notAllowed.map(async (resource) =>
|
||||
await agent.get(resource)
|
||||
.then((res) => {
|
||||
assert.equal(res.statusCode, 400)
|
||||
})
|
||||
));
|
||||
});
|
||||
|
||||
context('expiration', function(){
|
||||
it('has date, last-modified and expires header', async function() {
|
||||
await Promise.all(packages.map(async (resource) => await agent.get(resource)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue