Revert "Revert "Revert "Prerequisites to removing Facebook authentication (#13683)"""

This reverts commit e3ffd7acbc.
This commit is contained in:
SabreCat
2022-01-31 14:52:22 -06:00
parent a2f50815d8
commit de477ebb4a
12 changed files with 72 additions and 288 deletions

View File

@@ -1,4 +1,3 @@
import { v4 as generateUUID } from 'uuid';
import {
generateUser,
requester,
@@ -10,18 +9,15 @@ describe('GET /user/auth/apple', () => {
let api;
let user;
const appleEndpoint = '/user/auth/apple';
let randomAppleId = '123456';
before(async () => {
const expectedResult = { id: 'appleId', name: 'an apple user' };
sandbox.stub(appleAuth, 'appleProfile').returns(Promise.resolve(expectedResult));
});
beforeEach(async () => {
api = requester();
user = await generateUser();
randomAppleId = generateUUID();
const expectedResult = { id: randomAppleId, name: 'an apple user' };
sandbox.stub(appleAuth, 'appleProfile').returns(Promise.resolve(expectedResult));
});
afterEach(async () => {
appleAuth.appleProfile.restore();
});
it('registers a new user', async () => {
@@ -30,7 +26,7 @@ describe('GET /user/auth/apple', () => {
expect(response.apiToken).to.exist;
expect(response.id).to.exist;
expect(response.newUser).to.be.true;
await expect(getProperty('users', response.id, 'auth.apple.id')).to.eventually.equal(randomAppleId);
await expect(getProperty('users', response.id, 'auth.apple.id')).to.eventually.equal('appleId');
await expect(getProperty('users', response.id, 'profile.name')).to.eventually.equal('an apple user');
});