Category: Database, Docker

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')

Related Articles