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
Daniel Schaffer
committed
Mar 9, 2019
1 parent
1c347cf
commit a71f9e3
Showing
26 changed files
with
600 additions
and
401 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
export * from './src/pg.db.module' | ||
export * from './src/pg.db.client' | ||
export * from './src/pg.db.config' | ||
export * from './src/pg.db.model.builder.options' | ||
export * from './src/pg.db.pool' | ||
export * from './src/pg.db.pool.client' | ||
export * from './src/pg.db.transaction.client' | ||
export * from './src/invalid-transaction-state-error' | ||
export * from './src/pg-db.module' | ||
export * from './src/pg-db-client' | ||
export * from './src/pg-db-config' | ||
export * from './src/pg-db-model-builder-options' | ||
export * from './src/pg-db-pool' | ||
export * from './src/pg-db-pool-client' | ||
export * from './src/pg-db-query-error' | ||
export * from './src/pg-db-transaction-client' |
7 changes: 7 additions & 0 deletions
7
packages/dandi-contrib/data-pg/src/invalid-transaction-state-error.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,7 @@ | ||
import { AppError } from '@dandi/common' | ||
|
||
export class InvalidTransactionStateError extends AppError { | ||
constructor(message: string) { | ||
super(message) | ||
} | ||
} |
File renamed without changes.
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
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...ata-pg/src/pg.db.model.builder.options.ts → ...ata-pg/src/pg-db-model-builder-options.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
File renamed without changes.
32 changes: 32 additions & 0 deletions
32
packages/dandi-contrib/data-pg/src/pg-db-queryable.spec.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,32 @@ | ||
import { PgDbPoolClient } from '@dandi-contrib/data-pg' | ||
import { PgDbPoolClientFixture, PgDbQueryableBase, PgDbQueryableClient } from '@dandi-contrib/data-pg/testing' | ||
import { stubHarness } from '@dandi/core/testing' | ||
import { ModelBuilder } from '@dandi/model-builder' | ||
import { ModelBuilderFixture } from '@dandi/model-builder/testing' | ||
|
||
import { expect } from 'chai' | ||
|
||
describe('PgDbQueryableBase', function() { | ||
|
||
const harness = stubHarness( | ||
PgDbPoolClientFixture.factory, | ||
ModelBuilderFixture.factory, | ||
) | ||
|
||
beforeEach(async function() { | ||
PgDbPoolClientFixture.result({ rows: [{ id: 'a' }, { id: 'b' }] }) | ||
this.client = await harness.injectStub(PgDbPoolClient) | ||
this.queryable = new PgDbQueryableBase<PgDbQueryableClient>(this.client, await harness.inject(ModelBuilder)) | ||
}) | ||
|
||
describe('query', function() { | ||
it('passes the cmd and args arguments to the client', async function() { | ||
const cmd = 'SELECT foo FROM bar WHERE ix = $1' | ||
const args = 'nay' | ||
|
||
await this.queryable.query(cmd, args) | ||
|
||
expect(this.client.query).to.have.been.calledWithExactly(cmd, [args]) | ||
}) | ||
}) | ||
}) |
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.