fix(prettier): Properly handle lint-stage files (#6970)

Now handles top level files and recursive files in folders.

Set max line length to be 100
This commit is contained in:
Diamond Lewis
2020-10-25 15:06:58 -05:00
committed by GitHub
parent c2f2281e6d
commit e6ac3b6932
178 changed files with 5585 additions and 10688 deletions

View File

@@ -3,10 +3,8 @@
const request = require('../lib/request');
const MockEmailAdapterWithOptions = require('./MockEmailAdapterWithOptions');
const verifyPassword = function(login, password, isEmail = false) {
const body = !isEmail
? { username: login, password }
: { email: login, password };
const verifyPassword = function (login, password, isEmail = false) {
const body = !isEmail ? { username: login, password } : { email: login, password };
return request({
url: Parse.serverURL + '/verifyPassword',
headers: {
@@ -19,7 +17,7 @@ const verifyPassword = function(login, password, isEmail = false) {
.catch(err => err);
};
const isAccountLockoutError = function(username, password, duration, waitTime) {
const isAccountLockoutError = function (username, password, duration, waitTime) {
return new Promise((resolve, reject) => {
setTimeout(() => {
Parse.User.logIn(username, password)
@@ -81,9 +79,7 @@ describe('Verify User Password', () => {
})
.catch(err => {
expect(err.status).toBe(404);
expect(err.text).toMatch(
'{"code":101,"error":"Invalid username/password."}'
);
expect(err.text).toMatch('{"code":101,"error":"Invalid username/password."}');
done();
});
});
@@ -114,9 +110,7 @@ describe('Verify User Password', () => {
})
.catch(err => {
expect(err.status).toBe(400);
expect(err.text).toMatch(
'{"code":200,"error":"username/email is required."}'
);
expect(err.text).toMatch('{"code":200,"error":"username/email is required."}');
done();
});
});
@@ -147,9 +141,7 @@ describe('Verify User Password', () => {
})
.catch(err => {
expect(err.status).toBe(400);
expect(err.text).toMatch(
'{"code":200,"error":"username/email is required."}'
);
expect(err.text).toMatch('{"code":200,"error":"username/email is required."}');
done();
});
});
@@ -166,9 +158,7 @@ describe('Verify User Password', () => {
})
.then(res => {
expect(res.status).toBe(400);
expect(res.text).toMatch(
'{"code":200,"error":"username/email is required."}'
);
expect(res.text).toMatch('{"code":200,"error":"username/email is required."}');
done();
})
.catch(err => {
@@ -189,9 +179,7 @@ describe('Verify User Password', () => {
})
.then(res => {
expect(res.status).toBe(400);
expect(res.text).toMatch(
'{"code":200,"error":"username/email is required."}'
);
expect(res.text).toMatch('{"code":200,"error":"username/email is required."}');
done();
})
.catch(err => {
@@ -212,9 +200,7 @@ describe('Verify User Password', () => {
})
.then(res => {
expect(res.status).toBe(400);
expect(res.text).toMatch(
'{"code":201,"error":"password is required."}'
);
expect(res.text).toMatch('{"code":201,"error":"password is required."}');
done();
})
.catch(err => {
@@ -235,9 +221,7 @@ describe('Verify User Password', () => {
})
.then(res => {
expect(res.status).toBe(404);
expect(res.text).toMatch(
'{"code":101,"error":"Invalid username/password."}'
);
expect(res.text).toMatch('{"code":101,"error":"Invalid username/password."}');
done();
})
.catch(err => {
@@ -258,9 +242,7 @@ describe('Verify User Password', () => {
})
.then(res => {
expect(res.status).toBe(404);
expect(res.text).toMatch(
'{"code":101,"error":"Invalid username/password."}'
);
expect(res.text).toMatch('{"code":101,"error":"Invalid username/password."}');
done();
})
.catch(err => {
@@ -281,9 +263,7 @@ describe('Verify User Password', () => {
})
.then(res => {
expect(res.status).toBe(404);
expect(res.text).toMatch(
'{"code":101,"error":"Invalid username/password."}'
);
expect(res.text).toMatch('{"code":101,"error":"Invalid username/password."}');
done();
})
.catch(err => {
@@ -304,9 +284,7 @@ describe('Verify User Password', () => {
})
.then(res => {
expect(res.status).toBe(404);
expect(res.text).toMatch(
'{"code":101,"error":"Invalid username/password."}'
);
expect(res.text).toMatch('{"code":101,"error":"Invalid username/password."}');
done();
})
.catch(err => {
@@ -327,9 +305,7 @@ describe('Verify User Password', () => {
})
.then(res => {
expect(res.status).toBe(404);
expect(res.text).toMatch(
'{"code":101,"error":"Invalid username/password."}'
);
expect(res.text).toMatch('{"code":101,"error":"Invalid username/password."}');
done();
})
.catch(err => {
@@ -341,9 +317,7 @@ describe('Verify User Password', () => {
verifyPassword('mytestuser', 'mypass')
.then(res => {
expect(res.status).toBe(404);
expect(res.text).toMatch(
'{"code":101,"error":"Invalid username/password."}'
);
expect(res.text).toMatch('{"code":101,"error":"Invalid username/password."}');
done();
})
.catch(err => {
@@ -355,9 +329,7 @@ describe('Verify User Password', () => {
verifyPassword('my@user.com', 'mypass', true)
.then(res => {
expect(res.status).toBe(404);
expect(res.text).toMatch(
'{"code":101,"error":"Invalid username/password."}'
);
expect(res.text).toMatch('{"code":101,"error":"Invalid username/password."}');
done();
})
.catch(err => {
@@ -390,9 +362,7 @@ describe('Verify User Password', () => {
})
.then(res => {
expect(res.status).toBe(400);
expect(res.text).toMatch(
'{"code":205,"error":"User email is not verified."}'
);
expect(res.text).toMatch('{"code":205,"error":"User email is not verified."}');
done();
})
.catch(err => {
@@ -433,10 +403,7 @@ describe('Verify User Password', () => {
done();
})
.catch(err => {
fail(
'lock account after failed login attempts test failed: ' +
JSON.stringify(err)
);
fail('lock account after failed login attempts test failed: ' + JSON.stringify(err));
done();
});
});
@@ -469,12 +436,8 @@ describe('Verify User Password', () => {
const res = response.data;
expect(typeof res).toBe('object');
expect(typeof res['objectId']).toEqual('string');
expect(
Object.prototype.hasOwnProperty.call(res, 'sessionToken')
).toEqual(false);
expect(Object.prototype.hasOwnProperty.call(res, 'password')).toEqual(
false
);
expect(Object.prototype.hasOwnProperty.call(res, 'sessionToken')).toEqual(false);
expect(Object.prototype.hasOwnProperty.call(res, 'password')).toEqual(false);
done();
})
.catch(err => {
@@ -497,12 +460,8 @@ describe('Verify User Password', () => {
const res = response.data;
expect(typeof res).toBe('object');
expect(typeof res['objectId']).toEqual('string');
expect(
Object.prototype.hasOwnProperty.call(res, 'sessionToken')
).toEqual(false);
expect(Object.prototype.hasOwnProperty.call(res, 'password')).toEqual(
false
);
expect(Object.prototype.hasOwnProperty.call(res, 'sessionToken')).toEqual(false);
expect(Object.prototype.hasOwnProperty.call(res, 'password')).toEqual(false);
done();
});
});
@@ -521,12 +480,8 @@ describe('Verify User Password', () => {
const res = response.data;
expect(typeof res).toBe('object');
expect(typeof res['objectId']).toEqual('string');
expect(
Object.prototype.hasOwnProperty.call(res, 'sessionToken')
).toEqual(false);
expect(Object.prototype.hasOwnProperty.call(res, 'password')).toEqual(
false
);
expect(Object.prototype.hasOwnProperty.call(res, 'sessionToken')).toEqual(false);
expect(Object.prototype.hasOwnProperty.call(res, 'password')).toEqual(false);
done();
});
});
@@ -556,12 +511,8 @@ describe('Verify User Password', () => {
expect(typeof res).toBe('string');
const body = JSON.parse(res);
expect(typeof body['objectId']).toEqual('string');
expect(
Object.prototype.hasOwnProperty.call(body, 'sessionToken')
).toEqual(false);
expect(Object.prototype.hasOwnProperty.call(body, 'password')).toEqual(
false
);
expect(Object.prototype.hasOwnProperty.call(body, 'sessionToken')).toEqual(false);
expect(Object.prototype.hasOwnProperty.call(body, 'password')).toEqual(false);
done();
});
});
@@ -591,12 +542,8 @@ describe('Verify User Password', () => {
expect(typeof res).toBe('string');
const body = JSON.parse(res);
expect(typeof body['objectId']).toEqual('string');
expect(
Object.prototype.hasOwnProperty.call(body, 'sessionToken')
).toEqual(false);
expect(Object.prototype.hasOwnProperty.call(body, 'password')).toEqual(
false
);
expect(Object.prototype.hasOwnProperty.call(body, 'sessionToken')).toEqual(false);
expect(Object.prototype.hasOwnProperty.call(body, 'password')).toEqual(false);
done();
});
});
@@ -623,12 +570,8 @@ describe('Verify User Password', () => {
const res = response.data;
expect(typeof res).toBe('object');
expect(typeof res['objectId']).toEqual('string');
expect(
Object.prototype.hasOwnProperty.call(res, 'sessionToken')
).toEqual(false);
expect(Object.prototype.hasOwnProperty.call(res, 'password')).toEqual(
false
);
expect(Object.prototype.hasOwnProperty.call(res, 'sessionToken')).toEqual(false);
expect(Object.prototype.hasOwnProperty.call(res, 'password')).toEqual(false);
done();
});
});