Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(query-orchestrator): detects bigint in readOnly mode, when it's …
…Number
- Loading branch information
Showing
2 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
packages/cubejs-query-orchestrator/test/unit/BaseDriver.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { BaseDriver } from '../../src'; | ||
|
||
class BaseDriverImplementedMock extends BaseDriver { | ||
public constructor(protected readonly response: any) { | ||
super(); | ||
} | ||
|
||
public async query(query, values) { | ||
return this.response; | ||
} | ||
} | ||
|
||
describe('BaseDriver', () => { | ||
test('downloadQueryResults - test type detection', async () => { | ||
const rows = [{ | ||
bigint: 21474836479, | ||
int: 1, | ||
intstr: '1', | ||
string: 'str', | ||
}]; | ||
|
||
const driver = new BaseDriverImplementedMock(rows); | ||
|
||
expect((await driver.downloadQueryResults()).types).toEqual([ | ||
{ name: 'bigint', type: 'bigint' }, | ||
{ name: 'int', type: 'int' }, | ||
{ name: 'intstr', type: 'int' }, | ||
{ name: 'string', type: 'string' } | ||
]); | ||
}); | ||
}); |