Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
describe('negotiate()', () => {
const httpOperationConfig = {
code: chance.string(),
mediaType: chance.string(),
exampleKey: chance.string(),
dynamic: chance.bool()
};
const httpRequest: IHttpRequest = {
method: 'get',
path: '',
host: ''
};
const desiredConfig = {};
const httpOperation = anHttpOperation().instance();
function getOpts(resource: any, input: any, config: any) {
return { resource, input, config };
}
describe('given valid input', () => {
it('and negotiations succeed should return config', async () => {
jest.spyOn(helpers, 'negotiateOptionsForValidRequest').mockReturnValue(httpOperationConfig);
const result = await negotiator.negotiate(getOpts(httpOperation, {
data: httpRequest,
validations: {
input: []
}
}, desiredConfig));