| 381 | } |
| 382 | |
| 383 | function mockFacebookAuthenticator(id, token) { |
| 384 | const facebook = {}; |
| 385 | facebook.validateAuthData = function (authData) { |
| 386 | if (authData.id === id && authData.access_token.startsWith(token)) { |
| 387 | return Promise.resolve(); |
| 388 | } else { |
| 389 | throw undefined; |
| 390 | } |
| 391 | }; |
| 392 | facebook.validateAppId = function (appId, authData) { |
| 393 | if (authData.access_token.startsWith(token)) { |
| 394 | return Promise.resolve(); |
| 395 | } else { |
| 396 | throw undefined; |
| 397 | } |
| 398 | }; |
| 399 | return facebook; |
| 400 | } |
| 401 | |
| 402 | function mockFacebook() { |
| 403 | return mockFacebookAuthenticator('8675309', 'jenny'); |