Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions test/parallel/test-sqlite-aggregate-function.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,19 @@ describe('DatabaseSync.prototype.aggregate()', () => {
message: /The "options\.directOnly" argument must be a boolean/,
});
});

test('throws if options.inverse is not a function', (t) => {
t.assert.throws(() => {
db.aggregate('sum', {
start: 0,
step: (acc, value) => acc + value,
inverse: 10
});
}, {
code: 'ERR_INVALID_ARG_TYPE',
message: /The "options\.inverse" argument must be a function/,
});
});
});
});

Expand Down
11 changes: 11 additions & 0 deletions test/parallel/test-sqlite-template-tag.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@ beforeEach(() => {
sql.clear();
});

test('throws error if database is not open', () => {
const db = new DatabaseSync(':memory:', { open: false });

assert.throws(() => {
db.createTagStore(10);
}, {
code: 'ERR_INVALID_STATE',
message: 'database is not open'
});
});

test('sql.run inserts data', () => {
assert.strictEqual(sql.run`INSERT INTO foo (text) VALUES (${'bob'})`.changes, 1);
assert.strictEqual(sql.run`INSERT INTO foo (text) VALUES (${'mac'})`.changes, 1);
Expand Down
Loading