Fixes SchemaController data for Volatile Classes (#3171)
* Reproduction for the issue * Ensures Volatile classes and other schema share the same structure
This commit is contained in:
@@ -880,6 +880,38 @@ describe('SchemaController', () => {
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('properly handles volatile _Schemas', done => {
|
||||
function validateSchemaStructure(schema) {
|
||||
expect(schema.hasOwnProperty('className')).toBe(true);
|
||||
expect(schema.hasOwnProperty('fields')).toBe(true);
|
||||
expect(schema.hasOwnProperty('classLevelPermissions')).toBe(true);
|
||||
}
|
||||
function validateSchemaDataStructure(schemaData) {
|
||||
Object.keys(schemaData).forEach(className => {
|
||||
let schema = schemaData[className];
|
||||
// Hooks has className...
|
||||
if (className != '_Hooks') {
|
||||
expect(schema.hasOwnProperty('className')).toBe(false);
|
||||
}
|
||||
expect(schema.hasOwnProperty('fields')).toBe(false);
|
||||
expect(schema.hasOwnProperty('classLevelPermissions')).toBe(false);
|
||||
});
|
||||
}
|
||||
let schema;
|
||||
config.database.loadSchema().then(s => {
|
||||
schema = s;
|
||||
return schema.getOneSchema('_User', false);
|
||||
}).then(userSchema => {
|
||||
validateSchemaStructure(userSchema);
|
||||
validateSchemaDataStructure(schema.data);
|
||||
return schema.getOneSchema('_PushStatus', true);
|
||||
}).then(pushStatusSchema => {
|
||||
validateSchemaStructure(pushStatusSchema);
|
||||
validateSchemaDataStructure(schema.data);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Class Level Permissions for requiredAuth', () => {
|
||||
|
||||
Reference in New Issue
Block a user