Skip to content

Commit

Permalink
fix: lower case filename, and add canner adapter test case
Browse files Browse the repository at this point in the history
  • Loading branch information
onlyjackfrost committed May 25, 2023
1 parent 5d0b34d commit ac69cbb
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
3 changes: 3 additions & 0 deletions packages/extension-driver-canner/src/lib/CannerAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ export class CannerAdapter {
noLimit: true,
},
});
if (data.error.message) {
throw new Error(data.error.message);
}
const { id: requestId } = data;
await this.waitAsyncQueryToFinish(requestId);
const urls = await this.getAsyncQueryResultUrls(requestId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { buildSQL } from './sqlBuilder';
import { mapFromPGTypeId } from './typeMapper';
import * as fs from 'fs';
import * as path from 'path';
import { CannerAdapter } from './CannerAdapter';
import { CannerAdapter } from './cannerAdapter';

export interface PGOptions extends PoolConfig {
chunkSize?: number;
Expand Down
21 changes: 21 additions & 0 deletions packages/extension-driver-canner/test/cannerAdapter.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { CannerServer } from './cannerServer';
import { CannerAdapter } from '../src/lib/cannerAdapter';

const pg = new CannerServer();

it('CannerAdapter should get urls without throw any error when connection and sql are valid', async () => {
// Arrange
const { connection } = pg.getProfile('profile1');
const adapter = new CannerAdapter(connection);
// Act, Assert
await expect(
adapter.createAsyncQueryResultUrls('select 1')
).resolves.not.toThrow();
}, 50000);
it('CannerAdapter should throw when connection or sql are invalid', async () => {
// Arrange
const { connection } = pg.getProfile('profile1');
const adapter = new CannerAdapter(connection);
// Act, Assert
await expect(adapter.createAsyncQueryResultUrls('wrong')).rejects.toThrow(); //
}, 50000);
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ExportOptions, streamToArray } from '@vulcan-sql/core';
import { Writable } from 'stream';
import * as sinon from 'ts-sinon';
import * as fs from 'fs';
import { CannerAdapter } from '../src/lib/CannerAdapter';
import { CannerAdapter } from '../src/lib/cannerAdapter';

const pg = new CannerServer();
let dataSource: CannerDataSource;
Expand Down

0 comments on commit ac69cbb

Please sign in to comment.