Skip to content

Commit

Permalink
Fixed a few unhandled Promise rejections in a test case (#3705)
Browse files Browse the repository at this point in the history
  • Loading branch information
briandamaged committed Mar 6, 2020
1 parent 2270c11 commit 4006bdd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
3 changes: 1 addition & 2 deletions test/index.js
Expand Up @@ -9,8 +9,7 @@ global.chai.use(require('sinon-chai'));

global.d = new Date();

// '.timeout(ms, {cancel: true}) should throw error if cancellation cannot acquire connection' produced unhandled rejection and it's unclear how to avoid that
const EXPECTED_REJECTION_COUNT = 2;
const EXPECTED_REJECTION_COUNT = 0;
const rejectionLog = [];
process.on('unhandledRejection', (reason) => {
console.error('Unhandled rejection:', reason);
Expand Down
15 changes: 10 additions & 5 deletions test/integration/schema/index.js
Expand Up @@ -1671,7 +1671,8 @@ module.exports = (knex) => {
.then(() => {
if (/sqlite/i.test(knex.client.dialect)) {
//For SQLite inspect metadata to make sure the constraint exists
tr.select('type', 'name', 'tbl_name', 'sql')
return tr
.select('type', 'name', 'tbl_name', 'sql')
.from('sqlite_master')
.where({
type: 'table',
Expand Down Expand Up @@ -1702,7 +1703,8 @@ module.exports = (knex) => {
.then(() => {
if (/sqlite/i.test(knex.client.dialect)) {
//For SQLite inspect metadata to make sure the constraint exists
tr.select('type', 'name', 'tbl_name', 'sql')
return tr
.select('type', 'name', 'tbl_name', 'sql')
.from('sqlite_master')
.where({
type: 'table',
Expand Down Expand Up @@ -1746,7 +1748,8 @@ module.exports = (knex) => {
'` primary key (`test`, `test2`))',
},
];
tr.select('type', 'name', 'tbl_name', 'sql')
return tr
.select('type', 'name', 'tbl_name', 'sql')
.from('sqlite_master')
.where({
type: 'table',
Expand Down Expand Up @@ -1798,7 +1801,8 @@ module.exports = (knex) => {
'` (`test`)',
},
];
tr.select('type', 'name', 'tbl_name', 'sql')
return tr
.select('type', 'name', 'tbl_name', 'sql')
.from('sqlite_master')
.where({
type: 'index',
Expand Down Expand Up @@ -1861,7 +1865,8 @@ module.exports = (knex) => {
'` (`test`, `test2`)',
},
];
tr.select('type', 'name', 'tbl_name', 'sql')
return tr
.select('type', 'name', 'tbl_name', 'sql')
.from('sqlite_master')
.where({
type: 'index',
Expand Down

0 comments on commit 4006bdd

Please sign in to comment.