Skip to content

Commit d5b43da

Browse files
committedJul 29, 2018
test: more test fixes re: #6754
1 parent e91d404 commit d5b43da

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed
 

‎test/docs/transactions.test.js

+13-15
Original file line numberDiff line numberDiff line change
@@ -160,26 +160,24 @@ describe('transactions', function() {
160160

161161
beforeEach(function() {
162162
if (_skipped) {
163-
return this.skip(); // https://github.com/mochajs/mocha/issues/2546
164-
}
165-
return Author.deleteMany({}).then(() => Article.deleteMany({}));
166-
});
167-
168-
beforeEach(function() {
169-
if (_skipped) {
170-
return this.skip(); // https://github.com/mochajs/mocha/issues/2546
163+
this.skip();
164+
return Promise.resolve(); // https://github.com/mochajs/mocha/issues/2546
171165
}
172-
return db.startSession().then(_session => {
173-
session = _session;
174-
session.startTransaction();
175-
});
166+
return Author.deleteMany({}).
167+
then(() => Article.deleteMany({})).
168+
then(() => db.startSession()).
169+
then(_session => {
170+
session = _session;
171+
session.startTransaction();
172+
});
176173
});
177174

178-
afterEach(function() {
175+
afterEach(function(done) {
179176
if (_skipped) {
180-
return; // https://github.com/mochajs/mocha/issues/2546
177+
return done(); // https://github.com/mochajs/mocha/issues/2546
181178
}
182-
return session.commitTransaction();
179+
session.commitTransaction();
180+
done();
183181
});
184182

185183
it('`populate()` uses the querys session', function() {

0 commit comments

Comments
 (0)
Please sign in to comment.