Skip to content

Commit

Permalink
do not fix sqlite and adapt unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
livetocode committed Sep 22, 2024
1 parent 2e29a6c commit f87b412
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 20
- run: sudo apt update
- run: sudo apt install sqlite3=3.43.2
- run: sqlite3 --version
- run: npm ci
- run: npm test
env:
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ jobs:
with:
node-version: 20
registry-url: https://registry.npmjs.org/
- name: setup-sqlite-action
uses: ryohidaka/[email protected]
with:
version: 3.43.2
- run: npm ci
- run: npm run compile
- run: npm publish --access=public
Expand Down
22 changes: 15 additions & 7 deletions src/sorter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,21 @@ describe('Sorter', () => {
orderBy: [{ name: 'id' }],
logger: (msg) => { logs.push(msg); },
}, script);
}).rejects.toThrow(`Parse error near line 1: no such function: unknownfunc`);
expect(logs).toEqual([
'[SQLite] Parse error near line 1: no such function: unknownfunc',
'[SQLite] select unknownfunc(1);',
'[SQLite] ^--- error here',
'[SQLite] '
]);
}).rejects.toThrow(`no such function: unknownfunc`);
if (logs.some(x => x.includes('^--- error here'))) {
// The latest version of SQLite3 enhanced error reporting
expect(logs).toEqual([
'[SQLite] Parse error near line 1: no such function: unknownfunc',
'[SQLite] select unknownfunc(1);',
'[SQLite] ^--- error here',
'[SQLite] '
]);
} else {
expect(logs).toEqual([
'[SQLite] Error: near line 1: in prepare, no such function: unknownfunc (1)',
'[SQLite] '
]);
}
});
test('should fail with unknown sqlite command', async () => {
await expect(async () => {
Expand Down

0 comments on commit f87b412

Please sign in to comment.