diff --git a/libraries/User.js b/libraries/User.js index b786975f..d5c2868e 100644 --- a/libraries/User.js +++ b/libraries/User.js @@ -33,21 +33,21 @@ class User { 'authenticationFactorsEnabled', 'MFAEmail', 'followers', - 'following' + 'following', + '__v', + '_id', + 'totalLikes', + 'settings' ] const followers = userObject.followers.length; const following = userObject.following.length; - console.log('Followers length:', followers, ' | Followers Type:', typeof followers) - notIncludedKeys.forEach(x => delete userObject[x]) userObject.followers = followers userObject.following = following - userObject._id = userObject._id.toString() - return userObject; } diff --git a/tests/user/signin.test.js b/tests/user/signin.test.js index 47c215b5..55a0596c 100644 --- a/tests/user/signin.test.js +++ b/tests/user/signin.test.js @@ -291,7 +291,7 @@ describe('When Email 2FA is not enabled', () => { } test('if login works', async () => { - expect.assertions(12); + expect.assertions(11); await new User(userData).save(); @@ -343,7 +343,6 @@ describe('When Email 2FA is not enabled', () => { expect(includesNotIncludedKey).toBe(false); expect(typeof returned.data.data.followers).toBe("number"); expect(typeof returned.data.data.following).toBe("number"); - expect(typeof returned.data.data._id).toBe("string"); //End of test if correct user data gets returned diff --git a/tests/user/signup.test.js b/tests/user/signup.test.js index 175c62cd..191a5ecb 100644 --- a/tests/user/signup.test.js +++ b/tests/user/signup.test.js @@ -264,7 +264,7 @@ test('if signup fails if a user with the same name already exists', async () => for (const validUserEmail of VALID_EMAILS) { test(`if user account creation is successful with correct inputs. Email tested: ${validUserEmail}`, async () => { - expect.assertions(21); + expect.assertions(20); const benchmarkUserData = { name: validName, @@ -344,7 +344,6 @@ for (const validUserEmail of VALID_EMAILS) { expect(includesNotIncludedKey).toBe(false); expect(typeof returned.data.data.followers).toBe("number"); expect(typeof returned.data.data.following).toBe("number"); - expect(typeof returned.data.data._id).toBe("string"); expect(await DB.changedCollections()).toIncludeSameMembers(['User', 'RefreshToken']) }) }