Skip to content

Commit

Permalink
test(pg): more error handling tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanresnick committed Nov 30, 2022
1 parent bb4fb8d commit f1b8016
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions plugins/node/opentelemetry-instrumentation-pg/test/pg.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,26 @@ describe('pg', () => {
runCallbackTest(null, DEFAULT_ATTRIBUTES, [], errorStatus);
memoryExporter.reset();

assert.throws(
() => {
(client as any).query(null);
},
assertPgError,
'pg should throw when null provided as only arg'
);
runCallbackTest(null, DEFAULT_ATTRIBUTES, [], errorStatus);
memoryExporter.reset();

assert.throws(
() => {
(client as any).query(undefined);
},
assertPgError,
'pg should throw when null provided as only arg'
);
runCallbackTest(null, DEFAULT_ATTRIBUTES, [], errorStatus);
memoryExporter.reset();

assert.doesNotThrow(
() =>
(client as any).query({ foo: 'bar' }, undefined, () => {
Expand Down

0 comments on commit f1b8016

Please sign in to comment.