-
Notifications
You must be signed in to change notification settings - Fork 1
Initial implementation #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
543c023
to
08d10e2
Compare
test/index_test.js
Outdated
UnauthorizedError, | ||
ValidationFailedError | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can probably get rid of this test if we use the errors exported by the index in the other tests, i.e. changing from:
const ValidationFailedError = require('../../src/errors/validation-failed-error');
to
const { ValidationFailedError } = require('../../src');
it('should add custom properties', () => { | ||
expect(new UnauthorizedError({ foo: 'bar' }).foo).toBe('bar'); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3 out of 5 of these tests are common across the default HTTP errors. Is it possible to abstract them somehow, to avoid the duplication and the potential overlooked typos?
For instance, isolating them inside a util method, and in these HTTP error test files calling that util method. Just a suggestion, don't even know if that works with jest.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check the test util I created!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great 👍
Add errors for codes 409 and 500 as well? |
08d10e2
to
96d711e
Compare
@rplopes Added 409 and 410 errors, and left 500 out since it does not seem a common use case as we discussed online. |
96d711e
to
8f588af
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and working great. Should be ready to be used in our projects.
This PR adds the initial implementation of this module with the following errors: