@@ -1,46 +1,49 @@
|
||||
'use strict';
|
||||
|
||||
const MongoSchemaCollection = require('../lib/Adapters/Storage/Mongo/MongoSchemaCollection').default;
|
||||
const MongoSchemaCollection = require('../lib/Adapters/Storage/Mongo/MongoSchemaCollection')
|
||||
.default;
|
||||
|
||||
describe('MongoSchemaCollection', () => {
|
||||
it('can transform legacy _client_permissions keys to parse format', done => {
|
||||
expect(MongoSchemaCollection._TESTmongoSchemaToParseSchema({
|
||||
"_id":"_Installation",
|
||||
"_client_permissions":{
|
||||
"get":true,
|
||||
"find":true,
|
||||
"update":true,
|
||||
"create":true,
|
||||
"delete":true,
|
||||
},
|
||||
"_metadata":{
|
||||
"class_permissions":{
|
||||
"get":{"*":true},
|
||||
"find":{"*":true},
|
||||
"update":{"*":true},
|
||||
"create":{"*":true},
|
||||
"delete":{"*":true},
|
||||
"addField":{"*":true},
|
||||
expect(
|
||||
MongoSchemaCollection._TESTmongoSchemaToParseSchema({
|
||||
_id: '_Installation',
|
||||
_client_permissions: {
|
||||
get: true,
|
||||
find: true,
|
||||
update: true,
|
||||
create: true,
|
||||
delete: true,
|
||||
},
|
||||
"indexes": {
|
||||
"name1":{"deviceToken":1}
|
||||
}
|
||||
},
|
||||
"installationId":"string",
|
||||
"deviceToken":"string",
|
||||
"deviceType":"string",
|
||||
"channels":"array",
|
||||
"user":"*_User",
|
||||
"pushType":"string",
|
||||
"GCMSenderId":"string",
|
||||
"timeZone":"string",
|
||||
"localeIdentifier":"string",
|
||||
"badge":"number",
|
||||
"appVersion":"string",
|
||||
"appName":"string",
|
||||
"appIdentifier":"string",
|
||||
"parseVersion":"string",
|
||||
})).toEqual({
|
||||
_metadata: {
|
||||
class_permissions: {
|
||||
get: { '*': true },
|
||||
find: { '*': true },
|
||||
update: { '*': true },
|
||||
create: { '*': true },
|
||||
delete: { '*': true },
|
||||
addField: { '*': true },
|
||||
},
|
||||
indexes: {
|
||||
name1: { deviceToken: 1 },
|
||||
},
|
||||
},
|
||||
installationId: 'string',
|
||||
deviceToken: 'string',
|
||||
deviceType: 'string',
|
||||
channels: 'array',
|
||||
user: '*_User',
|
||||
pushType: 'string',
|
||||
GCMSenderId: 'string',
|
||||
timeZone: 'string',
|
||||
localeIdentifier: 'string',
|
||||
badge: 'number',
|
||||
appVersion: 'string',
|
||||
appName: 'string',
|
||||
appIdentifier: 'string',
|
||||
parseVersion: 'string',
|
||||
})
|
||||
).toEqual({
|
||||
className: '_Installation',
|
||||
fields: {
|
||||
installationId: { type: 'String' },
|
||||
@@ -71,7 +74,7 @@ describe('MongoSchemaCollection', () => {
|
||||
addField: { '*': true },
|
||||
},
|
||||
indexes: {
|
||||
name1: {deviceToken: 1}
|
||||
name1: { deviceToken: 1 },
|
||||
},
|
||||
});
|
||||
done();
|
||||
|
||||
Reference in New Issue
Block a user