Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6442229

Browse filesBrowse files
araujoguiaduh95
authored andcommitted
sqlite: add some tests
PR-URL: #61410 Reviewed-By: Edy Silva <edigleyssonsilva@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1 parent 069f360 commit 6442229
Copy full SHA for 6442229

2 files changed

+24Lines changed: 24 additions & 0 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎test/parallel/test-sqlite-aggregate-function.mjs‎

Copy file name to clipboardExpand all lines: test/parallel/test-sqlite-aggregate-function.mjs
+13Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,19 @@ describe('DatabaseSync.prototype.aggregate()', () => {
6868
message: /The "options\.directOnly" argument must be a boolean/,
6969
});
7070
});
71+
72+
test('throws if options.inverse is not a function', (t) => {
73+
t.assert.throws(() => {
74+
db.aggregate('sum', {
75+
start: 0,
76+
step: (acc, value) => acc + value,
77+
inverse: 10
78+
});
79+
}, {
80+
code: 'ERR_INVALID_ARG_TYPE',
81+
message: /The "options\.inverse" argument must be a function/,
82+
});
83+
});
7184
});
7285
});
7386

Collapse file

‎test/parallel/test-sqlite-template-tag.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-sqlite-template-tag.js
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,17 @@ beforeEach(() => {
1515
sql.clear();
1616
});
1717

18+
test('throws error if database is not open', () => {
19+
const db = new DatabaseSync(':memory:', { open: false });
20+
21+
assert.throws(() => {
22+
db.createTagStore(10);
23+
}, {
24+
code: 'ERR_INVALID_STATE',
25+
message: 'database is not open'
26+
});
27+
});
28+
1829
test('sql.run inserts data', () => {
1930
assert.strictEqual(sql.run`INSERT INTO foo (text) VALUES (${'bob'})`.changes, 1);
2031
assert.strictEqual(sql.run`INSERT INTO foo (text) VALUES (${'mac'})`.changes, 1);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.