Curated articles, resources, tips and trends from the DevOps World.
Summary: This is a summary of an article originally published by The New Stack. Read the full original article here →
https://www.linkedin.com/in/darin-spivey/' Testing external APIs can be tricky, especially if your company does not own the service/endpoint. So, what are some good approaches to testing external APIs?
This allows the user to control returned status codes, inspect POST bodies, query strings and just about anything a good test will want to do.
}) .query(() => { return true }) .delayConnection(delay + 1) .reply(200, 'Will Not Happen') // Not used, but still needed .post('/', () => { t.equal( logger[Symbol.for('isLoggingBackedOff')] , true , 'Logger is backed off' }) .query(() => { return true }) .delayConnection(delay + 1) .reply(200, 'Will Not Happen') .post('/', () => { return true }) .query(() => { return true }) .delayConnection(delay + 1) .reply(200, 'Will Not Happen') .post('/', () => { return true }) .query(() => { return true }) .reply(200, 'Success') logger.log('This will cause an HTTP timeout')
Made with pure grit © 2024 Jetpack Labs Inc. All rights reserved. www.jetpacklabs.com