Skip to content

Commit 2c8cf56

Browse files
committed
fix tests
1 parent f91d0c5 commit 2c8cf56

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

spec/ParseUser.spec.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,8 @@ describe('Parse.User testing', () => {
246246
await adapter.connect();
247247
await adapter.database.dropDatabase();
248248
delete adapter.connectionPromise;
249+
const { database } = Config.get(Parse.applicationId);
250+
database.schemaCache.clear();
249251

250252
const user = new Parse.User();
251253
await user.signUp({

src/Routers/SchemasRouter.js

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function getOneSchema(req) {
3535
});
3636
}
3737

38-
function createSchema(req) {
38+
async function createSchema(req) {
3939
if (req.auth.isReadOnly) {
4040
throw new Parse.Error(
4141
Parse.Error.OPERATION_FORBIDDEN,
@@ -53,17 +53,15 @@ function createSchema(req) {
5353
throw new Parse.Error(135, `POST ${req.path} needs a class name.`);
5454
}
5555

56-
return req.config.database
57-
.loadSchema({ clearCache: true })
58-
.then(schema =>
59-
schema.addClassIfNotExists(
60-
className,
61-
req.body.fields,
62-
req.body.classLevelPermissions,
63-
req.body.indexes
64-
)
65-
)
66-
.then(schema => ({ response: schema }));
56+
const schema = await req.config.database.loadSchema({ clearCache: true });
57+
const parseSchema = await schema.addClassIfNotExists(
58+
className,
59+
req.body.fields,
60+
req.body.classLevelPermissions,
61+
req.body.indexes
62+
);
63+
await schema.reloadData({ clearCache: true });
64+
return { response: parseSchema };
6765
}
6866

6967
function modifySchema(req) {

0 commit comments

Comments
 (0)