Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
test('should not match if no server defined', async () => {
const resource = await router.route({
resources: [{
id: chance.guid(),
method: pickOneHttpMethod(),
path: randomPath(),
responses: [],
servers: []
}],
input: {
method: pickOneHttpMethod(),
url: randomUrl()
}
});
expect(resource).toBeNull();
});
test('given a concrete matching server and unmatched methods should not match', async () => {
const url = randomUrl();
const [ resourceMethod, requestMethod ] = pickSetOfHttpMethods(2);
const resource = await router.route({
resources: [{
id: chance.guid(),
method: resourceMethod,
path: randomPath(),
responses: [],
servers: [{
url: url.toString(),
}]
}],
input: {
method: requestMethod,
url
}
});