Now handles top level files and recursive files in folders. Set max line length to be 100
34 lines
1.1 KiB
JavaScript
34 lines
1.1 KiB
JavaScript
const request = require('../lib/request');
|
|
|
|
describe('Enable express error handler', () => {
|
|
it('should call the default handler in case of error, like updating a non existing object', async done => {
|
|
const parseServer = await reconfigureServer(
|
|
Object.assign({}, defaultConfiguration, {
|
|
enableExpressErrorHandler: true,
|
|
})
|
|
);
|
|
parseServer.app.use(function (err, req, res, next) {
|
|
expect(err.message).toBe('Object not found.');
|
|
next(err);
|
|
});
|
|
|
|
try {
|
|
await request({
|
|
method: 'PUT',
|
|
url: defaultConfiguration.serverURL + '/classes/AnyClass/nonExistingId',
|
|
headers: {
|
|
'X-Parse-Application-Id': defaultConfiguration.appId,
|
|
'X-Parse-Master-Key': defaultConfiguration.masterKey,
|
|
'Content-Type': 'application/json',
|
|
},
|
|
body: { someField: 'blablabla' },
|
|
});
|
|
fail('Should throw error');
|
|
} catch (response) {
|
|
expect(response).toBeDefined();
|
|
expect(response.status).toEqual(500);
|
|
parseServer.server.close(done);
|
|
}
|
|
});
|
|
});
|