Add strip whitespace and trailing eol to spec too. (#3159)

This commit is contained in:
Arthur Cinader
2016-12-01 18:45:49 -08:00
committed by Florent Vilmart
parent 8359284329
commit 37daafc7b0
19 changed files with 38 additions and 36 deletions

View File

@@ -30,6 +30,8 @@
}, },
"rules": { "rules": {
"no-console": [0], "no-console": [0],
"indent": ["error", 2] "indent": ["error", 2],
"no-trailing-spaces": 2,
"eol-last": 2
} }
} }

View File

@@ -263,7 +263,7 @@ describe("Account Lockout Policy: ", () => {
return isAccountLockoutError('username3', 'wrong password', 0.05, 1); return isAccountLockoutError('username3', 'wrong password', 0.05, 1);
}) })
.then(() => { .then(() => {
// account should still be locked even after 2 seconds. // account should still be locked even after 2 seconds.
return isAccountLockoutError('username3', 'wrong password', 0.05, 2000); return isAccountLockoutError('username3', 'wrong password', 0.05, 2000);
}) })
.then(() => { .then(() => {
@@ -297,7 +297,7 @@ describe("Account Lockout Policy: ", () => {
return loginWithWrongCredentialsShouldFail('username4', 'wrong password'); return loginWithWrongCredentialsShouldFail('username4', 'wrong password');
}) })
.then(() => { .then(() => {
// allow locked user to login after 3 seconds with a valid userid and password // allow locked user to login after 3 seconds with a valid userid and password
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
setTimeout(() => { setTimeout(() => {
Parse.User.logIn('username4', 'correct password') Parse.User.logIn('username4', 'correct password')

View File

@@ -1,11 +1,11 @@
const analyticsAdapter = { const analyticsAdapter = {
appOpened: function() {}, appOpened: function() {},
trackEvent: function() {} trackEvent: function() {}
} }
describe('AnalyticsController', () => { describe('AnalyticsController', () => {
it('should track a simple event', (done) => { it('should track a simple event', (done) => {
spyOn(analyticsAdapter, 'trackEvent').and.callThrough(); spyOn(analyticsAdapter, 'trackEvent').and.callThrough();
reconfigureServer({ reconfigureServer({
analyticsAdapter analyticsAdapter
@@ -31,9 +31,9 @@ describe('AnalyticsController', () => {
done(); done();
}) })
}); });
it('should track a app opened event', (done) => { it('should track a app opened event', (done) => {
spyOn(analyticsAdapter, 'appOpened').and.callThrough(); spyOn(analyticsAdapter, 'appOpened').and.callThrough();
reconfigureServer({ reconfigureServer({
analyticsAdapter analyticsAdapter
@@ -58,4 +58,4 @@ describe('AnalyticsController', () => {
done(); done();
}) })
}) })
}) })

View File

@@ -20,12 +20,12 @@ describe('ClientSDK', () => {
version: '1.9.0' version: '1.9.0'
}); });
}); });
it('should properly sastisfy', () => { it('should properly sastisfy', () => {
expect(ClientSDK.compatible({ expect(ClientSDK.compatible({
js: '>=1.9.0' js: '>=1.9.0'
})("js1.9.0")).toBe(true); })("js1.9.0")).toBe(true);
expect(ClientSDK.compatible({ expect(ClientSDK.compatible({
js: '>=1.9.0' js: '>=1.9.0'
})("js2.0.0")).toBe(true); })("js2.0.0")).toBe(true);
@@ -38,4 +38,4 @@ describe('ClientSDK', () => {
js: '>=1.9.0' js: '>=1.9.0'
})(undefined)).toBe(true); })(undefined)).toBe(true);
}) })
}) })

View File

@@ -272,7 +272,7 @@ describe("httpRequest", () => {
Parse._encode(httpResponse); Parse._encode(httpResponse);
let serialized = JSON.stringify(httpResponse); let serialized = JSON.stringify(httpResponse);
let result = JSON.parse(serialized); let result = JSON.parse(serialized);
expect(httpResponse.text).toEqual('{"foo":"bar"}'); expect(httpResponse.text).toEqual('{"foo":"bar"}');
expect(httpResponse.data).toEqual({foo: 'bar'}); expect(httpResponse.data).toEqual({foo: 'bar'});
expect(httpResponse.body).toEqual({foo: 'bar'}); expect(httpResponse.body).toEqual({foo: 'bar'});

View File

@@ -120,4 +120,4 @@ describe('middlewares', () => {
}); });
}); });
}); });
}); });

View File

@@ -192,14 +192,14 @@ describe_only_db('mongo')('MongoStorageAdapter', () => {
it("handles updating a single object with array, object date", (done) => { it("handles updating a single object with array, object date", (done) => {
let adapter = new MongoStorageAdapter({ uri: databaseURI }); let adapter = new MongoStorageAdapter({ uri: databaseURI });
let schema = { fields: { let schema = { fields: {
array: { type: 'Array' }, array: { type: 'Array' },
object: { type: 'Object' }, object: { type: 'Object' },
date: { type: 'Date' }, date: { type: 'Date' },
} }; } };
adapter.createObject('MyClass', schema, {}) adapter.createObject('MyClass', schema, {})
.then(() => adapter._rawFind('MyClass', {})) .then(() => adapter._rawFind('MyClass', {}))
.then(results => { .then(results => {

View File

@@ -242,7 +242,7 @@ describe('parseObjectToMongoObjectForCreate', () => {
}; };
var output = transform.parseObjectToMongoObjectForCreate(null, input, { var output = transform.parseObjectToMongoObjectForCreate(null, input, {
fields: { fields: {
aRelation: { __type: 'Relation', className: 'Stuff' }, aRelation: { __type: 'Relation', className: 'Stuff' },
}, },
}); });
expect(output).toEqual({}); expect(output).toEqual({});
@@ -302,7 +302,7 @@ describe('transformUpdate', () => {
}; };
var output = transform.transformUpdate(null, input, { var output = transform.transformUpdate(null, input, {
fields: { fields: {
aRelation: { __type: 'Relation', className: 'Stuff' }, aRelation: { __type: 'Relation', className: 'Stuff' },
}, },
}); });
expect(output).toEqual({}); expect(output).toEqual({});

View File

@@ -288,9 +288,9 @@ describe('Installations', () => {
expect(results.length).toEqual(1); expect(results.length).toEqual(1);
expect(results[0]['_id']).toEqual(secondObject._id); expect(results[0]['_id']).toEqual(secondObject._id);
done(); done();
}).catch((error) => { }).catch((error) => {
jfail(error); jfail(error);
done(); done();
}); });
}); });

View File

@@ -928,7 +928,7 @@ describe('ParseLiveQueryServer', function() {
} }
} }
}); });
parseLiveQueryServer._matchesACL(acl, client, requestId).then(function(isMatched) { parseLiveQueryServer._matchesACL(acl, client, requestId).then(function(isMatched) {
expect(isMatched).toBe(false); expect(isMatched).toBe(false);
done(); done();

View File

@@ -115,4 +115,4 @@ describe('ParseServerRESTController', () => {
done(); done();
}); });
}); });
}); });

View File

@@ -2385,7 +2385,7 @@ describe('Parse.User testing', () => {
req.object.set('foo', 'bar'); req.object.set('foo', 'bar');
res.success(); res.success();
}); });
let originalSessionToken; let originalSessionToken;
let originalUserId; let originalUserId;
// Simulate anonymous user save // Simulate anonymous user save
@@ -2463,7 +2463,7 @@ describe('Parse.User testing', () => {
}); });
it('should send email when upgrading from anon', (done) => { it('should send email when upgrading from anon', (done) => {
let emailCalled = false; let emailCalled = false;
let emailOptions; let emailOptions;
var emailAdapter = { var emailAdapter = {
@@ -2768,7 +2768,7 @@ describe('Parse.User testing', () => {
}); });
}); });
it('should not fail querying non existing relations', done => { it('should not fail querying non existing relations', done => {
let user = new Parse.User(); let user = new Parse.User();
user.set({ user.set({
username: 'hello', username: 'hello',

View File

@@ -172,7 +172,7 @@ describe('rest query', () => {
'X-Parse-Application-Id': 'test', 'X-Parse-Application-Id': 'test',
'X-Parse-REST-API-Key': 'rest' 'X-Parse-REST-API-Key': 'rest'
}; };
let p0 = rp.get({ let p0 = rp.get({
headers: headers, headers: headers,
url: 'http://localhost:8378/1/classes/TestParameterEncode?' url: 'http://localhost:8378/1/classes/TestParameterEncode?'

View File

@@ -109,4 +109,4 @@ describe_only_db('mongo')('revocable sessions', () => {
done(); done();
}); });
}); });
}) })

View File

@@ -708,7 +708,7 @@ describe('SchemaController', () => {
}, () => { }, () => {
expect(exist).toEqual(false); expect(exist).toEqual(false);
}); });
}) })
.then(() => schema.deleteField('relationField', 'NewClass', config.database)) .then(() => schema.deleteField('relationField', 'NewClass', config.database))
.then(() => schema.reloadData()) .then(() => schema.reloadData())

View File

@@ -10,9 +10,9 @@ describe('Twitter Auth', () => {
}, { }, {
consumer_key: 'world' consumer_key: 'world'
}]).consumer_key).toEqual('hello') }]).consumer_key).toEqual('hello')
// Multiple options, consumer_key not found // Multiple options, consumer_key not found
expect(function(){ expect(function(){
twitter.handleMultipleConfigurations({ twitter.handleMultipleConfigurations({
consumer_key: 'some', consumer_key: 'some',
}, [{ }, [{
@@ -23,7 +23,7 @@ describe('Twitter Auth', () => {
}).toThrow(); }).toThrow();
// Multiple options, consumer_key not found // Multiple options, consumer_key not found
expect(function(){ expect(function(){
twitter.handleMultipleConfigurations({ twitter.handleMultipleConfigurations({
auth_token: 'token', auth_token: 'token',
}, [{ }, [{
@@ -47,4 +47,4 @@ describe('Twitter Auth', () => {
consumer_key: 'hello' consumer_key: 'hello'
}).consumer_key).toEqual('hello'); }).consumer_key).toEqual('hello');
}); });
}); });

View File

@@ -5,7 +5,7 @@ const SpecReporter = require('jasmine-spec-reporter');
jasmine.DEFAULT_TIMEOUT_INTERVAL = process.env.PARSE_SERVER_TEST_TIMEOUT || 5000; jasmine.DEFAULT_TIMEOUT_INTERVAL = process.env.PARSE_SERVER_TEST_TIMEOUT || 5000;
jasmine.getEnv().clearReporters(); jasmine.getEnv().clearReporters();
jasmine.getEnv().addReporter(new SpecReporter()); jasmine.getEnv().addReporter(new SpecReporter());
global.on_db = (db, callback, elseCallback) => { global.on_db = (db, callback, elseCallback) => {
if (process.env.PARSE_SERVER_TEST_DB == db) { if (process.env.PARSE_SERVER_TEST_DB == db) {

View File

@@ -31,4 +31,4 @@ describe('parsers', () => {
expect(parser(1)).toEqual(true); expect(parser(1)).toEqual(true);
expect(parser(2)).toEqual(false); expect(parser(2)).toEqual(false);
}); });
}); });

View File

@@ -10,7 +10,7 @@ var config = new Config('test');
let database = config.database; let database = config.database;
describe('rest create', () => { describe('rest create', () => {
beforeEach(() => { beforeEach(() => {
config = new Config('test'); config = new Config('test');
}); });