-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Alexey Zorkaltsev
committed
Jan 30, 2024
1 parent
1501444
commit 64c9e03
Showing
26 changed files
with
615 additions
and
99 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,86 @@ | ||
import Driver from '../../../driver'; | ||
import { | ||
createTable, | ||
destroyDriver, | ||
fillTableWithData, | ||
initDriver, | ||
Row, | ||
TABLE | ||
} from '../../../test-utils'; | ||
import {ReadTableSettings} from '../../../table'; | ||
import {TypedValues, TypedData} from '../../../types'; | ||
import {QuerySession} from "../../../query/query-session"; | ||
|
||
// async function execQuery(session: QuerySession): Promise<TypedData[]> { | ||
// const rows: TypedData[] = []; | ||
// | ||
// await session.streamReadTable(TABLE, (result) => { | ||
// if (result.resultSet) { | ||
// rows.push(...Row.createNativeObjects(result.resultSet)); | ||
// } | ||
// }, settings); | ||
// | ||
// return rows; | ||
// } | ||
|
||
describe('Query service', () => { | ||
let driver: Driver; | ||
|
||
beforeAll(async () => { | ||
driver = await initDriver(); | ||
}); | ||
|
||
afterAll(async () => await destroyDriver(driver)); | ||
|
||
it('Test', async () => { | ||
await driver.tableClient.withSession(async (session) => { | ||
const expectedRows = [ | ||
new Row({id: 1, title: 'one'}), | ||
new Row({id: 2, title: 'two'}), | ||
]; | ||
|
||
await createTable(session); | ||
|
||
// TODO: Create few tables | ||
|
||
// TODO: Make quries with few datasets | ||
|
||
await fillTableWithData(session, expectedRows); | ||
|
||
const res = await driver.queryClient.exec({ | ||
query: 'SELECT * FROM ${TABLE}', | ||
// Is callback a good name? | ||
callback: (session: QuerySession) => { | ||
// session.beginTransaction(), | ||
// TODO: query -> array | ||
// return; | ||
}, | ||
}); | ||
|
||
|
||
|
||
// { | ||
// const rows = await execQuery(session, new ReadTableSettings()); | ||
// expect(rows).toEqual(expectedRows); | ||
// } | ||
// | ||
// { | ||
// const rows = await readTable(session, new ReadTableSettings().withKeyRange({ | ||
// greaterOrEqual: TypedValues.tuple(TypedValues.optional(TypedValues.uint64(1))), | ||
// lessOrEqual: TypedValues.tuple(TypedValues.optional(TypedValues.uint64(2))), | ||
// })); | ||
// | ||
// expect(rows).toEqual(expectedRows); | ||
// } | ||
// | ||
// { | ||
// const rows = await readTable(session, new ReadTableSettings().withKeyRange({ | ||
// greater: TypedValues.tuple(TypedValues.optional(TypedValues.uint64(1))), | ||
// lessOrEqual: TypedValues.tuple(TypedValues.optional(TypedValues.uint64(2))), | ||
// })); | ||
// | ||
// expect(rows).toEqual(expectedRows.slice(1)); | ||
// } | ||
}); | ||
}); | ||
}); |
8 changes: 4 additions & 4 deletions
8
src/__tests__/alter-table.test.ts → ...s__/e2e/table-service/alter-table.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
6 changes: 3 additions & 3 deletions
6
src/__tests__/bulk-upsert.test.ts → ...s__/e2e/table-service/bulk-upsert.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
10 changes: 5 additions & 5 deletions
10
src/__tests__/bytestring-identity.test.ts → ...table-service/bytestring-identity.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
2 changes: 1 addition & 1 deletion
2
src/__tests__/connection.test.ts → ...ts__/e2e/table-service/connection.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
8 changes: 4 additions & 4 deletions
8
src/__tests__/create-table.test.ts → ...__/e2e/table-service/create-table.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
6 changes: 3 additions & 3 deletions
6
src/__tests__/graceful-session-close.test.ts → ...le-service/graceful-session-close.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
2 changes: 1 addition & 1 deletion
2
...__tests__/parse-connection-string.test.ts → ...e-service/parse-connection-string.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
8 changes: 4 additions & 4 deletions
8
src/__tests__/read-table.test.ts → ...ts__/e2e/table-service/read-table.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
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
8 changes: 4 additions & 4 deletions
8
src/__tests__/scan-query.test.ts → ...ts__/e2e/table-service/scan-query.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
6 changes: 3 additions & 3 deletions
6
src/__tests__/types.test.ts → ...__tests__/e2e/table-service/types.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
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
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
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
Oops, something went wrong.