Skip to content

Commit

Permalink
minor refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaly-t committed Mar 17, 2023
1 parent 156c850 commit fc0c4cb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 14 deletions.
15 changes: 3 additions & 12 deletions test/db.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2283,7 +2283,7 @@ describe('Task', () => {
tsk = this;
})
.then(() => {
// try use the task connection context outside of the task callback;
// try using the task connection context outside the task callback;
return tsk.query('select \'test\'');
})
.catch(err => {
Expand Down Expand Up @@ -2331,17 +2331,8 @@ describe('Task', () => {
});

describe('with a callback that returns a value', () => {
let result;
beforeEach(done => {
db.task(() => {
return 123;
})
.then(data => {
result = data;
})
.finally(done);
});
it('must resolve with the value', () => {
it('must resolve with the value', async () => {
const result = await db.task(() => 123);
expect(result).toBe(123);
});
});
Expand Down
3 changes: 1 addition & 2 deletions test/event.spec.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
const QueryStream = require('pg-query-stream');
const JSONStream = require('JSONStream');

const pgResult = require('pg/lib/result');
const pgClient = require('pg/lib/client');

const header = require('./db/header');

const promise = header.defPromise;

const options = {
promiseLib: promise, // use Bluebird for testing;
noWarnings: true
Expand Down
1 change: 1 addition & 0 deletions test/file.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const options = {
promiseLib: promise,
noWarnings: true
};

const dbHeader = header(options);
const pgp = dbHeader.pgp;
const db = dbHeader.db;
Expand Down

0 comments on commit fc0c4cb

Please sign in to comment.