不要怂,就是干,撸起袖子干!

Commit 702e3659 by Sushant Committed by GitHub

ci(postgres): remove extra beforeEach (#9681)

1 parent eda64954
'use strict'; 'use strict';
const _ = require('lodash'); const _ = require('lodash');
const Utils = require('./utils'); const Promise = require('./promise');
/** /**
* The transaction object is used to identify a running transaction. It is created by calling `Sequelize.transaction()`. * The transaction object is used to identify a running transaction. It is created by calling `Sequelize.transaction()`.
...@@ -57,7 +57,7 @@ class Transaction { ...@@ -57,7 +57,7 @@ class Transaction {
commit() { commit() {
if (this.finished) { if (this.finished) {
return Utils.Promise.reject(new Error('Transaction cannot be committed because it has been finished with state: ' + this.finished)); return Promise.reject(new Error('Transaction cannot be committed because it has been finished with state: ' + this.finished));
} }
this._clearCls(); this._clearCls();
...@@ -73,9 +73,9 @@ class Transaction { ...@@ -73,9 +73,9 @@ class Transaction {
} }
return null; return null;
}).tap( }).tap(
() => Utils.Promise.each( () => Promise.each(
this._afterCommitHooks, this._afterCommitHooks,
hook => Utils.Promise.resolve(hook.apply(this, [this]))) hook => Promise.resolve(hook.apply(this, [this])))
); );
} }
...@@ -87,7 +87,7 @@ class Transaction { ...@@ -87,7 +87,7 @@ class Transaction {
rollback() { rollback() {
if (this.finished) { if (this.finished) {
return Utils.Promise.reject(new Error('Transaction cannot be rolled back because it has been finished with state: ' + this.finished)); return Promise.reject(new Error('Transaction cannot be rolled back because it has been finished with state: ' + this.finished));
} }
this._clearCls(); this._clearCls();
...@@ -112,7 +112,7 @@ class Transaction { ...@@ -112,7 +112,7 @@ class Transaction {
} }
if (this.parent) { if (this.parent) {
connectionPromise = Utils.Promise.resolve(this.parent.connection); connectionPromise = Promise.resolve(this.parent.connection);
} else { } else {
const acquireOptions = { uuid: this.id }; const acquireOptions = { uuid: this.id };
if (this.options.readOnly) { if (this.options.readOnly) {
......
...@@ -9,22 +9,22 @@ const chai = require('chai'), ...@@ -9,22 +9,22 @@ const chai = require('chai'),
_ = require('lodash'); _ = require('lodash');
if (dialect.match(/^postgres/)) { if (dialect.match(/^postgres/)) {
const constraintName = 'overlap_period';
beforeEach(function() {
const self = this;
this.Booking = self.sequelize.define('Booking', {
roomNo: DataTypes.INTEGER,
period: DataTypes.RANGE(DataTypes.DATE)
});
return self.Booking
.sync({ force: true })
.then(() => {
return self.sequelize.query('ALTER TABLE "' + self.Booking.tableName + '" ADD CONSTRAINT ' + constraintName +
' EXCLUDE USING gist ("roomNo" WITH =, period WITH &&)');
});
});
describe('[POSTGRES Specific] ExclusionConstraintError', () => { describe('[POSTGRES Specific] ExclusionConstraintError', () => {
const constraintName = 'overlap_period';
beforeEach(function() {
const self = this;
this.Booking = self.sequelize.define('Booking', {
roomNo: DataTypes.INTEGER,
period: DataTypes.RANGE(DataTypes.DATE)
});
return self.Booking
.sync({ force: true })
.then(() => {
return self.sequelize.query(
`ALTER TABLE "${self.Booking.tableName}" ADD CONSTRAINT ${constraintName} EXCLUDE USING gist ("roomNo" WITH =, period WITH &&)`
);
});
});
it('should contain error specific properties', () => { it('should contain error specific properties', () => {
const errDetails = { const errDetails = {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!