Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('uses static example', () => {
assertSome(generate({ examples: [{ key: 'foo', value: 'test' }] }), v =>
expect(v).toEqual('test')
);
});
});
it('should respect the q parameter', () => {
const possibleResponse = findBestHttpContentByMediaType(avaiableResponses, [
'application/json;q=0.8',
'application/xml;q=1',
]);
assertSome(possibleResponse, response => expect(response).toHaveProperty('mediaType', 'application/xml'));
});
});
it('will return error for convertible values', () => {
assertSome(
validateAgainstSchema({ test: 10 }, { type: 'object', properties: { test: { type: 'string' } } }, false),
error => expect(error).toContainEqual(expect.objectContaining({ message: 'should be string' }))
);
});
});
it('returns default response', () => {
assertSome(
findOperationResponse(
[
{ code: '2XX', contents: [], headers: [] },
{ code: 'default', contents: [], headers: [] },
{ code: '1XX', contents: [], headers: [] },
],
422,
),
value => expect(value).toEqual({ code: 'default', contents: [], headers: [] }),
);
});
});