Skip to content

Commit ec61bd5

Browse files
committed
chore(build): Random database names for Travis multi-tests
Tests may break on same database
1 parent c53e378 commit ec61bd5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/__mocks__/mongooseCommon.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import mongoose, { Schema } from 'mongoose';
22

3-
const dbName = 'gqc-mongoose-test';
3+
function getRandomInt(min, max) {
4+
return Math.floor(Math.random() * (max - min)) + min;
5+
}
6+
7+
const dbName = `gqc-mongoose-test${getRandomInt(1, 1000000)}`;
48
const uri = `mongodb://127.0.0.1:27017/${dbName}`;
59

610
mongoose.Promise = Promise;

0 commit comments

Comments
 (0)