Fix issues and tests

This commit is contained in:
Phillip Thelen
2021-11-17 18:43:06 +01:00
parent c244b1651c
commit bfdfcc9901
5 changed files with 179 additions and 23 deletions
@@ -9,9 +9,11 @@ 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' };
beforeEach(async () => {
randomAppleId = generateUUID();
const expectedResult = { id: randomAppleId, name: 'an apple user' };
sandbox.stub(appleAuth, 'appleProfile').returns(Promise.resolve(expectedResult));
});
@@ -26,7 +28,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');
});