Fix 500 errors coming from Google scripts (#15237)

* fix issue with userFields options

* remove only

---------

Co-authored-by: Phillip Thelen <phillip@habitica.com>
This commit is contained in:
Sabe Jones
2024-09-03 18:15:35 -05:00
committed by GitHub
parent f9d3c6ed48
commit 2483e19bee
2 changed files with 21 additions and 1 deletions
+18
View File
@@ -40,6 +40,24 @@ describe('GET /user', () => {
expect(returnedUser.stats).to.not.exist;
});
it('returns when ALWAYS_LOADED paths are requested', async () => {
const returnedUser = await user.get('/user?userFields=_id,notifications,preferences,auth,flags,permissions');
expect(returnedUser._id).to.equal(user._id);
expect(returnedUser.notifications).to.exist;
expect(returnedUser.preferences).to.exist;
expect(returnedUser.auth).to.exist;
expect(returnedUser.flags).to.exist;
expect(returnedUser.permissions).to.exist;
});
it('returns when subpaths paths are requested', async () => {
const returnedUser = await user.get('/user?userFields=auth.local.username');
expect(returnedUser._id).to.equal(user._id);
expect(returnedUser.auth.local.username).to.exist;
});
it('does not return requested private properties', async () => {
const returnedUser = await user.get('/user?userFields=apiToken,secret.text');