committed by
Florent Vilmart
parent
f8403943ab
commit
a103871cbc
@@ -4,7 +4,7 @@ var defaultColumns = require('../src/Controllers/SchemaController').defaultColum
|
||||
var authenticationLoader = require('../src/Adapters/Auth');
|
||||
var path = require('path');
|
||||
|
||||
describe('AuthenticationProviers', function() {
|
||||
describe('AuthenticationProviders', function() {
|
||||
["facebook", "github", "instagram", "google", "linkedin", "meetup", "twitter", "janrainengage", "janraincapture", "vkontakte"].map(function(providerName){
|
||||
it("Should validate structure of " + providerName, (done) => {
|
||||
var provider = require("../src/Adapters/Auth/" + providerName);
|
||||
@@ -230,10 +230,10 @@ describe('AuthenticationProviers', function() {
|
||||
expect(typeof validator).toBe('function');
|
||||
}
|
||||
|
||||
function validateAuthenticationHandler(authenticatonHandler) {
|
||||
expect(authenticatonHandler).not.toBeUndefined();
|
||||
expect(typeof authenticatonHandler.getValidatorForProvider).toBe('function');
|
||||
expect(typeof authenticatonHandler.getValidatorForProvider).toBe('function');
|
||||
function validateAuthenticationHandler(authenticationHandler) {
|
||||
expect(authenticationHandler).not.toBeUndefined();
|
||||
expect(typeof authenticationHandler.getValidatorForProvider).toBe('function');
|
||||
expect(typeof authenticationHandler.getValidatorForProvider).toBe('function');
|
||||
}
|
||||
|
||||
function validateAuthenticationAdapter(authAdapter) {
|
||||
|
||||
@@ -132,7 +132,7 @@ describe('server', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('throws if you initialize email adapter incorrecly', done => {
|
||||
it('throws if you initialize email adapter incorrectly', done => {
|
||||
reconfigureServer({
|
||||
appName: 'unused',
|
||||
verifyUserEmails: true,
|
||||
@@ -428,7 +428,7 @@ describe('server', () => {
|
||||
})
|
||||
});
|
||||
|
||||
it('should suceed if you provide valid ip in masterKeyIps', done => {
|
||||
it('should succeed if you provide valid ip in masterKeyIps', done => {
|
||||
reconfigureServer({ masterKeyIps: ['1.2.3.4','2001:0db8:0000:0042:0000:8a2e:0370:7334'] })
|
||||
.then(done)
|
||||
});
|
||||
|
||||
@@ -115,7 +115,7 @@ class MongoSchemaCollection {
|
||||
.then(schemas => schemas.map(mongoSchemaToParseSchema));
|
||||
}
|
||||
|
||||
_fechOneSchemaFrom_SCHEMA(name: string) {
|
||||
_fetchOneSchemaFrom_SCHEMA(name: string) {
|
||||
return this._collection._rawFind(_mongoSchemaQueryFromNameQuery(name), { limit: 1 }).then(results => {
|
||||
if (results.length === 1) {
|
||||
return mongoSchemaToParseSchema(results[0]);
|
||||
@@ -150,7 +150,7 @@ class MongoSchemaCollection {
|
||||
|
||||
// TODO: don't spend an extra query on finding the schema if the type we are trying to add isn't a GeoPoint.
|
||||
addFieldIfNotExists(className: string, fieldName: string, type: string) {
|
||||
return this._fechOneSchemaFrom_SCHEMA(className)
|
||||
return this._fetchOneSchemaFrom_SCHEMA(className)
|
||||
.then(schema => {
|
||||
// The schema exists. Check for existing GeoPoints.
|
||||
if (type.type === 'GeoPoint') {
|
||||
|
||||
@@ -203,7 +203,7 @@ export class MongoStorageAdapter {
|
||||
.then(schemaCollection => schemaCollection.findAndDeleteSchema(className))
|
||||
}
|
||||
|
||||
// Delete all data known to this adatper. Used for testing.
|
||||
// Delete all data known to this adapter. Used for testing.
|
||||
deleteAllClasses() {
|
||||
return storageAdapterAllCollections(this)
|
||||
.then(collections => Promise.all(collections.map(collection => collection.drop())));
|
||||
@@ -220,7 +220,7 @@ export class MongoStorageAdapter {
|
||||
// Pointer field names are passed for legacy reasons: the original mongo
|
||||
// format stored pointer field names differently in the database, and therefore
|
||||
// needed to know the type of the field before it could delete it. Future database
|
||||
// adatpers should ignore the pointerFieldNames argument. All the field names are in
|
||||
// adapters should ignore the pointerFieldNames argument. All the field names are in
|
||||
// fieldNames, they show up additionally in the pointerFieldNames database for use
|
||||
// by the mongo adapter, which deals with the legacy mongo format.
|
||||
|
||||
@@ -265,12 +265,12 @@ export class MongoStorageAdapter {
|
||||
// undefined as the reason.
|
||||
getClass(className) {
|
||||
return this._schemaCollection()
|
||||
.then(schemasCollection => schemasCollection._fechOneSchemaFrom_SCHEMA(className))
|
||||
.then(schemasCollection => schemasCollection._fetchOneSchemaFrom_SCHEMA(className))
|
||||
}
|
||||
|
||||
// TODO: As yet not particularly well specified. Creates an object. Maybe shouldn't even need the schema,
|
||||
// and should infer from the type. Or maybe does need the schema for validations. Or maybe needs
|
||||
// the schem only for the legacy mongo format. We'll figure that out later.
|
||||
// the schema only for the legacy mongo format. We'll figure that out later.
|
||||
createObject(className, schema, object) {
|
||||
schema = convertParseSchemaToMongoSchema(schema);
|
||||
const mongoObject = parseObjectToMongoObjectForCreate(className, object, schema);
|
||||
|
||||
Reference in New Issue
Block a user