import/export: On export error return 500 instead of crashing

This commit is contained in:
Richard Hansen 2021-03-17 18:54:57 -04:00 committed by John McLear
parent 3a11e97758
commit 83f39289aa
3 changed files with 31 additions and 6 deletions

View file

@ -0,0 +1,26 @@
'use strict';
const common = require('../common');
const padManager = require('../../../node/db/PadManager');
const settings = require('../../../node/utils/Settings');
describe(__filename, function () {
let agent;
const settingsBackup = {};
before(async function () {
agent = await common.init();
settingsBackup.soffice = settings.soffice;
await padManager.getPad('testExportPad', 'test content');
});
after(async function () {
Object.assign(settings, settingsBackup);
});
it('returns 500 on export error', async function () {
settings.soffice = 'false'; // '/bin/false' doesn't work on Windows
await agent.get('/p/testExportPad/export/doc')
.expect(500);
});
});