Merge pull request from GHSA-2479-qvv7-47qq

* Failing test

* provide fix

* clearer test

* failing expect
This commit is contained in:
Diamond Lewis
2019-06-12 16:12:11 -05:00
committed by GitHub
parent 54ba9a0f00
commit 8709daf698
2 changed files with 29 additions and 3 deletions

View File

@@ -1,6 +1,7 @@
const auth = require('../lib/Auth');
const Config = require('../lib/Config');
const rest = require('../lib/rest');
const request = require('../lib/request');
const AudiencesRouter = require('../lib/Routers/AudiencesRouter')
.AudiencesRouter;
@@ -438,4 +439,28 @@ describe('AudiencesRouter', () => {
});
});
});
it('should handle _Audience invalid fields via rest', async () => {
await reconfigureServer({
appId: 'test',
restAPIKey: 'test',
publicServerURL: 'http://localhost:8378/1',
});
try {
await request({
method: 'POST',
url: 'http://localhost:8378/1/classes/_Audience',
body: { lorem: 'ipsum', _method: 'POST' },
headers: {
'X-Parse-Application-Id': 'test',
'X-Parse-REST-API-Key': 'test',
'Content-Type': 'application/json',
},
});
expect(true).toBeFalsy();
} catch (e) {
expect(e.data.code).toBe(107);
expect(e.data.error).toBe('Could not add field lorem');
}
});
});