Skip to content

Commit 63a780e

Browse files
committed
test: move tests in right file
1 parent ca12c23 commit 63a780e

File tree

2 files changed

+28
-28
lines changed

2 files changed

+28
-28
lines changed

test/parallel/test-sqlite-statement-sync.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,34 @@ suite('StatementSync.prototype.all()', () => {
7777
});
7878
});
7979

80+
suite('StatementSync.prototype.iterate()', () => {
81+
test('executes a query and returns an empty iterator on no results', (t) => {
82+
const db = new DatabaseSync(nextDb());
83+
const stmt = db.prepare('CREATE TABLE storage(key TEXT, val TEXT)');
84+
t.assert.deepStrictEqual(stmt.iterate().toArray(), []);
85+
});
86+
87+
test('executes a query and returns all results', (t) => {
88+
const db = new DatabaseSync(nextDb());
89+
let stmt = db.prepare('CREATE TABLE storage(key TEXT, val TEXT)');
90+
t.assert.deepStrictEqual(stmt.run(), { changes: 0, lastInsertRowid: 0 });
91+
stmt = db.prepare('INSERT INTO storage (key, val) VALUES (?, ?)');
92+
t.assert.deepStrictEqual(
93+
stmt.run('key1', 'val1'),
94+
{ changes: 1, lastInsertRowid: 1 },
95+
);
96+
t.assert.deepStrictEqual(
97+
stmt.run('key2', 'val2'),
98+
{ changes: 1, lastInsertRowid: 2 },
99+
);
100+
stmt = db.prepare('SELECT * FROM storage ORDER BY key');
101+
t.assert.deepStrictEqual(stmt.iterate().toArray(), [
102+
{ key: 'key1', val: 'val1' },
103+
{ key: 'key2', val: 'val2' },
104+
]);
105+
});
106+
});
107+
80108
suite('StatementSync.prototype.run()', () => {
81109
test('executes a query and returns change metadata', (t) => {
82110
const db = new DatabaseSync(nextDb());

test/parallel/test-sqlite.js

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -97,31 +97,3 @@ test('PRAGMAs are supported', (t) => {
9797
{ journal_mode: 'wal' },
9898
);
9999
});
100-
101-
suite('StatementSync.prototype.iterate()', () => {
102-
test('executes a query and returns an empty iterator on no results', (t) => {
103-
const db = new DatabaseSync(nextDb());
104-
const stmt = db.prepare('CREATE TABLE storage(key TEXT, val TEXT)');
105-
t.assert.deepStrictEqual(stmt.iterate().toArray(), []);
106-
});
107-
108-
test('executes a query and returns all results', (t) => {
109-
const db = new DatabaseSync(nextDb());
110-
let stmt = db.prepare('CREATE TABLE storage(key TEXT, val TEXT)');
111-
t.assert.deepStrictEqual(stmt.run(), { changes: 0, lastInsertRowid: 0 });
112-
stmt = db.prepare('INSERT INTO storage (key, val) VALUES (?, ?)');
113-
t.assert.deepStrictEqual(
114-
stmt.run('key1', 'val1'),
115-
{ changes: 1, lastInsertRowid: 1 },
116-
);
117-
t.assert.deepStrictEqual(
118-
stmt.run('key2', 'val2'),
119-
{ changes: 1, lastInsertRowid: 2 },
120-
);
121-
stmt = db.prepare('SELECT * FROM storage ORDER BY key');
122-
t.assert.deepStrictEqual(stmt.iterate().toArray(), [
123-
{ key: 'key1', val: 'val1' },
124-
{ key: 'key2', val: 'val2' },
125-
]);
126-
});
127-
});

0 commit comments

Comments
 (0)