forked from beekeeper-studio/beekeeper-studio
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
4 changed files
with
7 additions
and
22 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
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
version: '3' | ||
services: | ||
cockroachdb: | ||
image: cockroachdb/cockroach | ||
image: cockroachdb/cockroach:v22.1.1 | ||
ports: | ||
- 26257 | ||
command: start-single-node --insecure | ||
command: start-single-node --insecure |
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 |
---|---|---|
|
@@ -4,7 +4,7 @@ import { DBConnection, IDbConnectionServerConfig } from '../../src/lib/db/client | |
import { createServer } from '../../src/lib/db/index' | ||
import log from 'electron-log' | ||
import platformInfo from '../../src/common/platform_info' | ||
import { IDbConnectionPublicServer } from '@/lib/db/server' | ||
import { IDbConnectionPublicServer } from '../../src/lib/db/server' | ||
import { AlterTableSpec, Dialect, DialectData } from '../../../../shared/src/lib/dialects/models' | ||
import { getDialectData } from '../../../../shared/src/lib/dialects/' | ||
import _ from 'lodash' | ||
|
@@ -97,7 +97,6 @@ export class DBTestUtil { | |
await this.connection.connect() | ||
await this.createTables() | ||
const address = this.maybeArrayToObject(await this.knex("addresses").insert({country: "US"}).returning("id"), 'id') | ||
console.log("address result:", address) | ||
await this.knex("MixedCase").insert({bananas: "pears"}).returning("id") | ||
const people = this.maybeArrayToObject(await this.knex("people").insert({ email: "[email protected]", address_id: address[0].id}).returning("id"), 'id') | ||
const jobs = this.maybeArrayToObject(await this.knex("jobs").insert({job_name: "Programmer"}).returning("id"), 'id') | ||
|
@@ -128,7 +127,6 @@ export class DBTestUtil { | |
*/ | ||
async tableViewTests() { | ||
|
||
console.log("table tests") | ||
// reserved word as table name | ||
expect(await this.connection.getPrimaryKey("group", this.defaultSchema)) | ||
.toBe("id"); | ||
|
@@ -188,7 +186,6 @@ export class DBTestUtil { | |
await this.connection.alterTable(simpleChange) | ||
const simpleResult = await this.connection.listTableColumns('alter_test') | ||
|
||
console.log(simpleResult) | ||
expect(simpleResult.find((c) => c.columnName === 'family_name')).toBeTruthy() | ||
|
||
|
||
|
@@ -330,7 +327,6 @@ export class DBTestUtil { | |
|
||
async queryTests() { | ||
if (this.dbType === 'sqlite') return | ||
console.log('query tests') | ||
const q = await this.connection.query("select 'a' as total, 'b' as total") | ||
if(!q) throw new Error("no query result") | ||
const result = await q.execute() | ||
|
@@ -405,7 +401,7 @@ export class DBTestUtil { | |
const updatedIndexes = updatedIndexesRaw.filter((i) => !i.primary) | ||
|
||
const picked = updatedIndexes.map((i) => _.pick(i, ['name', 'columns', 'table', 'schema'])) | ||
expect(picked).toEqual( | ||
expect(picked).toMatchObject( | ||
[ | ||
{ | ||
name: 'it_idx2', | ||
|
@@ -418,7 +414,6 @@ export class DBTestUtil { | |
} | ||
|
||
async streamTests() { | ||
console.log('selectTopStream tests') | ||
const names = [ | ||
{ name: "Matthew" }, | ||
{ name: "Nicoll" }, | ||
|
@@ -440,30 +435,19 @@ export class DBTestUtil { | |
5, | ||
undefined, | ||
) | ||
console.log("checking columns and total row count") | ||
expect(result.columns.map(c => c.columnName)).toMatchObject(['id', 'name']) | ||
expect(result.totalRows).toBe(6) | ||
const cursor = result.cursor | ||
console.log("starting cursor") | ||
await cursor.start() | ||
console.log("length?") | ||
const b1 = await cursor.read() | ||
expect(b1.length).toBe(5) | ||
console.log("reading first five names and checking those") | ||
console.log(b1) | ||
expect(b1.map(r => r[1])).toMatchObject(names.map(r => r.name).slice(0, 5)) | ||
console.log("read2") | ||
const b2 = await cursor.read() | ||
expect(b2.length).toBe(1) | ||
expect(b2[0][1]).toBe(names[names.length - 1].name) | ||
console.log("read 3") | ||
const b3 = await cursor.read() | ||
expect(b3).toMatchObject([]) | ||
console.log("closing") | ||
await cursor.close() | ||
|
||
|
||
|
||
} | ||
|
||
private async createTables() { | ||
|
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