chore(package): update jasmine to version 3.0.0 (#4553)

* chore(package): update jasmine to version 3.0.0

Closes #4547

* Fixes failing tests for jasmine 3.0

Starting 3.0, done(something) will fail

* Update tests so they dont leverage var, but let and const

With jasmine 3.0, the randomization engine was making the test fails because of the scope of `var`

* Remove randomizer

* Use same adapter for PG tests, drop table to ensure the tests dont side effect
This commit is contained in:
Florent Vilmart
2018-02-17 09:55:30 -05:00
committed by GitHub
parent 8ec7785d53
commit b754d51e8e
81 changed files with 2698 additions and 2704 deletions

View File

@@ -1,13 +1,13 @@
var request = require('request');
var Config = require("../src/Config");
var defaultColumns = require('../src/Controllers/SchemaController').defaultColumns;
var authenticationLoader = require('../src/Adapters/Auth');
var path = require('path');
const request = require('request');
const Config = require("../src/Config");
const defaultColumns = require('../src/Controllers/SchemaController').defaultColumns;
const authenticationLoader = require('../src/Adapters/Auth');
const path = require('path');
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);
const provider = require("../src/Adapters/Auth/" + providerName);
jequal(typeof provider.validateAuthData, "function");
jequal(typeof provider.validateAppId, "function");
const authDataPromise = provider.validateAuthData({}, {});
@@ -20,7 +20,7 @@ describe('AuthenticationProviders', function() {
});
});
var getMockMyOauthProvider = function() {
const getMockMyOauthProvider = function() {
return {
authData: {
id: "12345",
@@ -70,18 +70,18 @@ describe('AuthenticationProviders', function() {
}
});
var createOAuthUser = function(callback) {
const createOAuthUser = function(callback) {
return createOAuthUserWithSessionToken(undefined, callback);
}
var createOAuthUserWithSessionToken = function(token, callback) {
var jsonBody = {
const createOAuthUserWithSessionToken = function(token, callback) {
const jsonBody = {
authData: {
myoauth: getMockMyOauthProvider().authData
}
};
var options = {
const options = {
headers: {'X-Parse-Application-Id': 'test',
'X-Parse-REST-API-Key': 'rest',
'X-Parse-Installation-Id': 'yolo',
@@ -105,12 +105,12 @@ describe('AuthenticationProviders', function() {
it("should create user with REST API", done => {
createOAuthUser((error, response, body) => {
expect(error).toBe(null);
var b = body;
const b = body;
ok(b.sessionToken);
expect(b.objectId).not.toBeNull();
expect(b.objectId).not.toBeUndefined();
var sessionToken = b.sessionToken;
var q = new Parse.Query("_Session");
const sessionToken = b.sessionToken;
const q = new Parse.Query("_Session");
q.equalTo('sessionToken', sessionToken);
q.first({useMasterKey: true}).then((res) => {
if (!res) {
@@ -128,17 +128,17 @@ describe('AuthenticationProviders', function() {
});
it("should only create a single user with REST API", (done) => {
var objectId;
let objectId;
createOAuthUser((error, response, body) => {
expect(error).toBe(null);
var b = body
const b = body
expect(b.objectId).not.toBeNull();
expect(b.objectId).not.toBeUndefined();
objectId = b.objectId;
createOAuthUser((error, response, body) => {
expect(error).toBe(null);
var b = body;
const b = body;
expect(b.objectId).not.toBeNull();
expect(b.objectId).not.toBeUndefined();
expect(b.objectId).toBe(objectId);
@@ -164,7 +164,7 @@ describe('AuthenticationProviders', function() {
});
it("unlink and link with custom provider", (done) => {
var provider = getMockMyOauthProvider();
const provider = getMockMyOauthProvider();
Parse.User._registerAuthenticationProvider(provider);
Parse.User._logInWith("myoauth", {
success: function(model) {
@@ -186,7 +186,7 @@ describe('AuthenticationProviders', function() {
ok(!provider.synchronizedExpiration,
"Expiration should be cleared");
// make sure the auth data is properly deleted
var config = Config.get(Parse.applicationId);
const config = Config.get(Parse.applicationId);
config.database.adapter.find('_User', {
fields: Object.assign({}, defaultColumns._Default, defaultColumns._Installation),
}, { objectId: model.id }, {})
@@ -244,7 +244,7 @@ describe('AuthenticationProviders', function() {
}
it('properly loads custom adapter', (done) => {
var validAuthData = {
const validAuthData = {
id: 'hello',
token: 'world'
}