Skip to content

Commit 0eff786

Browse files
stage88acinader
authored andcommitted
Fix failing tests
1 parent 019cf0a commit 0eff786

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

spec/MongoStorageAdapter.spec.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ const { MongoClient } = require('mongodb');
66
const databaseURI =
77
'mongodb://localhost:27017/parseServerMongoAdapterTestDatabase';
88

9+
const fakeClient = {
10+
s: { options: { dbName: null } },
11+
db: () => null,
12+
};
13+
914
// These tests are specific to the mongo storage adapter + mongo storage format
1015
// and will eventually be moved into their own repo
1116
describe_only_db('mongo')('MongoStorageAdapter', () => {
@@ -16,7 +21,7 @@ describe_only_db('mongo')('MongoStorageAdapter', () => {
1621
});
1722

1823
it('auto-escapes symbols in auth information', () => {
19-
spyOn(MongoClient, 'connect').and.returnValue(Promise.resolve(null));
24+
spyOn(MongoClient, 'connect').and.returnValue(Promise.resolve(fakeClient));
2025
new MongoStorageAdapter({
2126
uri:
2227
'mongodb://user!with@+ symbols:password!with@+ symbols@localhost:1234/parse',
@@ -28,7 +33,7 @@ describe_only_db('mongo')('MongoStorageAdapter', () => {
2833
});
2934

3035
it("doesn't double escape already URI-encoded information", () => {
31-
spyOn(MongoClient, 'connect').and.returnValue(Promise.resolve(null));
36+
spyOn(MongoClient, 'connect').and.returnValue(Promise.resolve(fakeClient));
3237
new MongoStorageAdapter({
3338
uri:
3439
'mongodb://user!with%40%2B%20symbols:password!with%40%2B%20symbols@localhost:1234/parse',
@@ -41,7 +46,7 @@ describe_only_db('mongo')('MongoStorageAdapter', () => {
4146

4247
// https://github.com/parse-community/parse-server/pull/148#issuecomment-180407057
4348
it('preserves replica sets', () => {
44-
spyOn(MongoClient, 'connect').and.returnValue(Promise.resolve(null));
49+
spyOn(MongoClient, 'connect').and.returnValue(Promise.resolve(fakeClient));
4550
new MongoStorageAdapter({
4651
uri:
4752
'mongodb://test:testpass@ds056315-a0.mongolab.com:59325,ds059315-a1.mongolab.com:59315/testDBname?replicaSet=rs-ds059415',

0 commit comments

Comments
 (0)