add common HTTP errors

This commit is contained in:
Tim Alby
2019-07-29 18:25:31 +02:00
parent 0dd8b124bd
commit 9229c9b3a9
4 changed files with 111 additions and 2 deletions
+20
View File
@@ -0,0 +1,20 @@
const OError = require('..')
const HttpErrors = require('../http')
describe('OError/http', () => {
it('is instance of OError', () => {
try {
throw new HttpErrors.ConflictError()
} catch (e) {
expect(e).to.be.instanceof(OError)
}
})
it('has status code', () => {
try {
throw new HttpErrors.ConflictError()
} catch (e) {
expect(e.statusCode).to.equal(409)
}
})
})