feat: Deprecation DEPPS5: Config option allowClientClassCreation defaults to false (#8849)

BREAKING CHANGE: The Parse Server option `allowClientClassCreation` defaults to `false`.
This commit is contained in:
Onur
2024-03-05 22:05:54 +03:00
committed by GitHub
parent fe1e4d9775
commit 29624e0fae
8 changed files with 43 additions and 7 deletions

View File

@@ -4402,3 +4402,31 @@ describe('login as other user', () => {
done();
});
});
describe('allowClientClassCreation option', () => {
it('should enforce boolean values', async () => {
const options = [[], 'a', '', 0, 1, {}, 'true', 'false'];
for (const option of options) {
await expectAsync(reconfigureServer({ allowClientClassCreation: option })).toBeRejected();
}
});
it('should accept true value', async () => {
await reconfigureServer({ allowClientClassCreation: true });
expect(Config.get(Parse.applicationId).allowClientClassCreation).toBe(true);
});
it('should accept false value', async () => {
await reconfigureServer({ allowClientClassCreation: false });
expect(Config.get(Parse.applicationId).allowClientClassCreation).toBe(false);
});
it('should default false', async () => {
// remove predefined allowClientClassCreation:true on global defaultConfiguration
delete defaultConfiguration.allowClientClassCreation;
await reconfigureServer(defaultConfiguration);
expect(Config.get(Parse.applicationId).allowClientClassCreation).toBe(false);
// Need to set it back to true to avoid other test fails
defaultConfiguration.allowClientClassCreation = true;
});
});

View File

@@ -129,6 +129,7 @@ const defaultConfiguration = {
},
shortLivedAuth: mockShortLivedAuth(),
},
allowClientClassCreation: true,
};
if (process.env.PARSE_SERVER_TEST_CACHE === 'redis') {