| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -68,6 +68,19 @@ describe('DatabaseSync.prototype.aggregate()', () => { | |||
| 68 | 68 | message: /The "options\.directOnly" argument must be a boolean/, | |
| 69 | 69 | }); | |
| 70 | 70 | }); | |
| 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 | + }); | ||
| 71 | 84 | }); | |
| 72 | 85 | }); | |
| 73 | 86 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -15,6 +15,17 @@ beforeEach(() => { | |||
| 15 | 15 | sql.clear(); | |
| 16 | 16 | }); | |
| 17 | 17 | ||
| 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 | + | ||
| 18 | 29 | test('sql.run inserts data', () => { | |
| 19 | 30 | assert.strictEqual(sql.run`INSERT INTO foo (text) VALUES (${'bob'})`.changes, 1); | |
| 20 | 31 | assert.strictEqual(sql.run`INSERT INTO foo (text) VALUES (${'mac'})`.changes, 1); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments