-
Notifications
You must be signed in to change notification settings - Fork 60
Throw an error when oid is missing #129
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
0ecb5ea to
03b8699
Compare
|
I'm not sure how to correctly use tape to test that the thrown error is TypeError |
Codecov Report
@@ Coverage Diff @@
## master #129 +/- ##
==========================================
+ Coverage 91.74% 93.26% +1.52%
==========================================
Files 4 4
Lines 206 208 +2
==========================================
+ Hits 189 194 +5
+ Misses 17 14 -3
Continue to review full report at Codecov.
|
|
You can use a regex in the second arg of t.test('setTypeParser should throw when oid is not an integer', function (t) {
t.throws(function () {
setTypeParser(null, function () {})
}, /^TypeError: oid must be an integer/) // <-- Add this
t.throws(function () {
setTypeParser('a', function () {})
}, /^TypeError: oid must be an integer/) // <-- Add this
t.end()
}) |
|
Ha, ok. Done and force-pushed. |
|
Perfect, thanks! |
|
LGTM. @bendrucker Should add a note that the only thing this might break is someone setting a parser using the string representation of an int for the oid value. That would have worked before as the prop lookup of the oid gets stringified but I don't think it's a big deal to break that use case. A note should be fine as it's undocumented behavior and anyone would see it at app startup too. |
|
Good catch! This is going to go out in a major release that's months overdue here anyway. Will make sure to note it in the main pg changelog. |
This reverts commit 8594bc6.
Fixes #128