2021-03-12 05:46:01 +03:00
|
|
|
const testUtils = require('../../utils');
|
|
|
|
const importer = require('../../../core/server/data/importer');
|
|
|
|
const dataImporter = importer.importers[1];
|
|
|
|
|
2021-03-12 08:28:48 +03:00
|
|
|
const {exportedBodyLegacy} = require('../../utils/fixtures/export/body-generator');
|
2021-03-12 05:46:01 +03:00
|
|
|
|
|
|
|
const importOptions = {
|
|
|
|
returnImportedData: true
|
|
|
|
};
|
|
|
|
|
2021-11-16 19:53:48 +03:00
|
|
|
describe('Importer Legacy', function () {
|
2021-03-12 05:46:01 +03:00
|
|
|
beforeEach(testUtils.teardownDb);
|
2021-11-18 18:29:35 +03:00
|
|
|
beforeEach(testUtils.setup('roles', 'owner'));
|
2021-03-12 05:46:01 +03:00
|
|
|
|
2021-03-12 08:28:48 +03:00
|
|
|
it('disallows importing Legacy imports', function () {
|
|
|
|
const exportData = exportedBodyLegacy().db[0];
|
2021-03-12 05:46:01 +03:00
|
|
|
|
|
|
|
return dataImporter.doImport(exportData, importOptions)
|
|
|
|
.then(function () {
|
2021-03-12 08:28:48 +03:00
|
|
|
'0'.should.eql(1, 'Legacy import should fail');
|
2021-03-12 05:46:01 +03:00
|
|
|
})
|
|
|
|
.catch(function (err) {
|
|
|
|
err.message.should.eql('Detected unsupported file structure.');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|