mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-15 05:37:22 +01:00
Pull in missing changes from FB removal PR (#13931)
* fix(auth): hide post hoc Facebook reg * Pull in missing changes * fix(lint): whitespace * fix(strings): missing error message * fix(tests): update to match functionality Co-authored-by: SabreCat <sabe@habitica.com>
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { v4 as generateUUID } from 'uuid';
|
||||
import {
|
||||
generateUser,
|
||||
requester,
|
||||
@@ -9,15 +10,18 @@ describe('GET /user/auth/apple', () => {
|
||||
let api;
|
||||
let user;
|
||||
const appleEndpoint = '/user/auth/apple';
|
||||
|
||||
before(async () => {
|
||||
const expectedResult = { id: 'appleId', name: 'an apple user' };
|
||||
sandbox.stub(appleAuth, 'appleProfile').returns(Promise.resolve(expectedResult));
|
||||
});
|
||||
let randomAppleId = '123456';
|
||||
|
||||
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 () => {
|
||||
@@ -26,7 +30,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('appleId');
|
||||
await expect(getProperty('users', response.id, 'auth.apple.id')).to.eventually.equal(randomAppleId);
|
||||
await expect(getProperty('users', response.id, 'profile.name')).to.eventually.equal('an apple user');
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user