@@ -880,6 +880,38 @@ describe('SchemaController', () => {
880
880
done ( ) ;
881
881
} ) ;
882
882
} ) ;
883
+
884
+ it ( 'properly handles volatile _Schemas' , done => {
885
+ function validateSchemaStructure ( schema ) {
886
+ expect ( schema . hasOwnProperty ( 'className' ) ) . toBe ( true ) ;
887
+ expect ( schema . hasOwnProperty ( 'fields' ) ) . toBe ( true ) ;
888
+ expect ( schema . hasOwnProperty ( 'classLevelPermissions' ) ) . toBe ( true ) ;
889
+ }
890
+ function validateSchemaDataStructure ( schemaData ) {
891
+ Object . keys ( schemaData ) . forEach ( className => {
892
+ let schema = schemaData [ className ] ;
893
+ // Hooks has className...
894
+ if ( className != '_Hooks' ) {
895
+ expect ( schema . hasOwnProperty ( 'className' ) ) . toBe ( false ) ;
896
+ }
897
+ expect ( schema . hasOwnProperty ( 'fields' ) ) . toBe ( false ) ;
898
+ expect ( schema . hasOwnProperty ( 'classLevelPermissions' ) ) . toBe ( false ) ;
899
+ } ) ;
900
+ }
901
+ let schema ;
902
+ config . database . loadSchema ( ) . then ( s => {
903
+ schema = s ;
904
+ return schema . getOneSchema ( '_User' , false ) ;
905
+ } ) . then ( userSchema => {
906
+ validateSchemaStructure ( userSchema ) ;
907
+ validateSchemaDataStructure ( schema . data ) ;
908
+ return schema . getOneSchema ( '_PushStatus' , true ) ;
909
+ } ) . then ( pushStatusSchema => {
910
+ validateSchemaStructure ( pushStatusSchema ) ;
911
+ validateSchemaDataStructure ( schema . data ) ;
912
+ done ( ) ;
913
+ } ) ;
914
+ } ) ;
883
915
} ) ;
884
916
885
917
describe ( 'Class Level Permissions for requiredAuth' , ( ) => {
0 commit comments