Joi now converts input to matching option from .valid()

This commit is contained in:
spalger 2019-10-23 06:50:05 -07:00
parent a2ec603ffb
commit 75531b1d09

View file

@ -17,6 +17,8 @@
* under the License.
*/
import Url from 'url';
import sinon from 'sinon';
import * as requestModule from '../../request';
import expect from '@kbn/expect';
@ -44,12 +46,15 @@ describe('Console Proxy Route', () => {
teardowns.push(() => server.stop());
const params = [];
if (path != null) params.push(`path=${path}`);
if (method != null) params.push(`method=${method}`);
return await server.inject({
method: 'POST',
url: `/api/console/proxy${params.length ? `?${params.join('&')}` : ''}`,
url: Url.format({
pathname: '/api/console/proxy',
query: {
path: path == null ? undefined : path,
method: method == null ? undefined : method,
}
}),
});
};
});
@ -125,11 +130,11 @@ describe('Console Proxy Route', () => {
});
});
describe('is mixed case', () => {
it('sends a request with the exact method', async () => {
it('sends a request with the method properly cased', async () => {
const { statusCode } = await request('HeAd', '/');
expect(statusCode).to.be(200);
sinon.assert.calledOnce(requestModule.sendRequest);
expect(requestModule.sendRequest.getCall(0).args[0].method).to.be('HeAd');
expect(requestModule.sendRequest.getCall(0).args[0].method).to.be('HEAD');
});
});
});