Schema Cache Improvement 2 (#5616)

* schema hasClass improvement

* create object improvement

* destroy object

* update object

* hasClass test rewrite

* more tests

* improve signing up users
This commit is contained in:
Diamond Lewis
2019-05-30 11:14:05 -05:00
committed by GitHub
parent 9f226a254a
commit cc6d474dcb
8 changed files with 572 additions and 405 deletions

View File

@@ -181,31 +181,26 @@ describe('rest query', () => {
);
});
it('query existent class when disabled client class creation', done => {
it('query existent class when disabled client class creation', async () => {
const customConfig = Object.assign({}, config, {
allowClientClassCreation: false,
});
config.database
.loadSchema()
.then(schema => schema.addClassIfNotExists('ClientClassCreation', {}))
.then(actualSchema => {
expect(actualSchema.className).toEqual('ClientClassCreation');
return rest.find(
customConfig,
auth.nobody(customConfig),
'ClientClassCreation',
{}
);
})
.then(
result => {
expect(result.results.length).toEqual(0);
done();
},
() => {
fail('Should not throw error');
}
);
const schema = await config.database.loadSchema();
const actualSchema = await schema.addClassIfNotExists(
'ClientClassCreation',
{}
);
expect(actualSchema.className).toEqual('ClientClassCreation');
await schema.reloadData({ clearCache: true });
// Should not throw
const result = await rest.find(
customConfig,
auth.nobody(customConfig),
'ClientClassCreation',
{}
);
expect(result.results.length).toEqual(0);
});
it('query with wrongly encoded parameter', done => {