Let auth data be updated on login (#2219)
* Let user update authData token upon login * Adds tests that ensures linked authData isnt overriden * fixes focused testing problem
This commit is contained in:
@@ -281,17 +281,17 @@ function range(n) {
|
||||
return answer;
|
||||
}
|
||||
|
||||
function mockFacebook() {
|
||||
function mockFacebookAuthenticator(id, token) {
|
||||
var facebook = {};
|
||||
facebook.validateAuthData = function(authData) {
|
||||
if (authData.id === '8675309' && authData.access_token === 'jenny') {
|
||||
if (authData.id === id && authData.access_token.startsWith(token)) {
|
||||
return Promise.resolve();
|
||||
} else {
|
||||
throw undefined;
|
||||
}
|
||||
};
|
||||
facebook.validateAppId = function(appId, authData) {
|
||||
if (authData.access_token === 'jenny') {
|
||||
if (authData.access_token.startsWith(token)) {
|
||||
return Promise.resolve();
|
||||
} else {
|
||||
throw undefined;
|
||||
@@ -300,6 +300,10 @@ function mockFacebook() {
|
||||
return facebook;
|
||||
}
|
||||
|
||||
function mockFacebook() {
|
||||
return mockFacebookAuthenticator('8675309', 'jenny');
|
||||
}
|
||||
|
||||
|
||||
|
||||
// This is polluting, but, it makes it way easier to directly port old tests.
|
||||
@@ -320,6 +324,7 @@ global.jequal = jequal;
|
||||
global.range = range;
|
||||
global.reconfigureServer = reconfigureServer;
|
||||
global.defaultConfiguration = defaultConfiguration;
|
||||
global.mockFacebookAuthenticator = mockFacebookAuthenticator;
|
||||
|
||||
global.it_exclude_dbs = excluded => {
|
||||
if (excluded.includes(process.env.PARSE_SERVER_TEST_DB)) {
|
||||
|
||||
Reference in New Issue
Block a user