Skip to content

Commit 4fead08

Browse files
committed
fix: test to mongo
1 parent 7f46c6a commit 4fead08

File tree

1 file changed

+48
-34
lines changed

1 file changed

+48
-34
lines changed

spec/DatabaseController.spec.js

Lines changed: 48 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -367,40 +367,54 @@ describe('DatabaseController', () => {
367367
expect(spy.calls.all()[0].args[3].caseInsensitive).toEqual(true);
368368
});
369369

370-
it('should create insensitive indexes without disableCaseInsensitivity', async () => {
371-
await reconfigureServer({
372-
databaseURI: 'mongodb://localhost:27017/disableCaseInsensitivityFalse',
373-
databaseAdapter: undefined,
374-
});
375-
const user = new Parse.User();
376-
await user.save({ username: 'example', password: 'password', email: '[email protected]' });
377-
const schemas = await Parse.Schema.all();
378-
const UserSchema = schemas.find(({ className }) => className === '_User');
379-
expect(UserSchema.indexes).toEqual({
380-
_id_: { _id: 1 },
381-
username_1: { username: 1 },
382-
case_insensitive_username: { username: 1 },
383-
case_insensitive_email: { email: 1 },
384-
email_1: { email: 1 },
385-
});
386-
});
387-
388-
it('should not create insensitive indexes with disableCaseInsensitivity', async () => {
389-
await reconfigureServer({
390-
disableCaseInsensitivity: true,
391-
databaseURI: 'mongodb://localhost:27017/disableCaseInsensitivityTrue',
392-
databaseAdapter: undefined,
393-
});
394-
const user = new Parse.User();
395-
await user.save({ username: 'example', password: 'password', email: '[email protected]' });
396-
const schemas = await Parse.Schema.all();
397-
const UserSchema = schemas.find(({ className }) => className === '_User');
398-
expect(UserSchema.indexes).toEqual({
399-
_id_: { _id: 1 },
400-
username_1: { username: 1 },
401-
email_1: { email: 1 },
402-
});
403-
});
370+
it_only_db('mongo')(
371+
'should create insensitive indexes without disableCaseInsensitivity',
372+
async () => {
373+
await reconfigureServer({
374+
databaseURI: 'mongodb://localhost:27017/disableCaseInsensitivityFalse',
375+
databaseAdapter: undefined,
376+
});
377+
const user = new Parse.User();
378+
await user.save({
379+
username: 'example',
380+
password: 'password',
381+
382+
});
383+
const schemas = await Parse.Schema.all();
384+
const UserSchema = schemas.find(({ className }) => className === '_User');
385+
expect(UserSchema.indexes).toEqual({
386+
_id_: { _id: 1 },
387+
username_1: { username: 1 },
388+
case_insensitive_username: { username: 1 },
389+
case_insensitive_email: { email: 1 },
390+
email_1: { email: 1 },
391+
});
392+
}
393+
);
394+
395+
it_only_db('mongo')(
396+
'should not create insensitive indexes with disableCaseInsensitivity',
397+
async () => {
398+
await reconfigureServer({
399+
disableCaseInsensitivity: true,
400+
databaseURI: 'mongodb://localhost:27017/disableCaseInsensitivityTrue',
401+
databaseAdapter: undefined,
402+
});
403+
const user = new Parse.User();
404+
await user.save({
405+
username: 'example',
406+
password: 'password',
407+
408+
});
409+
const schemas = await Parse.Schema.all();
410+
const UserSchema = schemas.find(({ className }) => className === '_User');
411+
expect(UserSchema.indexes).toEqual({
412+
_id_: { _id: 1 },
413+
username_1: { username: 1 },
414+
email_1: { email: 1 },
415+
});
416+
}
417+
);
404418
});
405419

406420
describe('forceEmailAndUsernameToLowerCase', () => {

0 commit comments

Comments
 (0)