MCPcopy Create free account
hub / github.com/WiseLibs/better-sqlite3 / expectError

Function expectError

test/32.database.function.js:105–114  ·  view source on GitHub ↗
(name, exception)

Source from the content-addressed store, hash-verified

103 });
104 it('should propagate exceptions thrown in the registered function', function () {
105 const expectError = (name, exception) => {
106 this.db.function(name, () => { throw exception; });
107 try {
108 this.get(name + '()');
109 } catch (ex) {
110 expect(ex).to.equal(exception);
111 return;
112 }
113 throw new TypeError('Expected function to throw an exception');
114 };
115 expectError('a', new TypeError('foobar'));
116 expectError('b', new Error('baz'));
117 expectError('c', { yup: 'ok' });

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected