mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-29 22:01:49 +03:00
a5484a0fe1
https://github.com/TryGhost/Toolbox/issues/130 The transaction no longer commits in the promise chain, which wasn't valid logic for a transaction, since it is commited automatically when the promise chain resolves, and rollsback automatically when the promise chain rejects. This makes code which fails during the transaction error in the right place, instead of getting stuck here. (Especially good for writing tests). The tests for this code can now live in the integration folder.
27 lines
871 B
JavaScript
27 lines
871 B
JavaScript
const testUtils = require('../../utils');
|
|
const importer = require('../../../core/server/data/importer');
|
|
const dataImporter = importer.importers[1];
|
|
|
|
const {exportedBodyLegacy} = require('../../utils/fixtures/export/body-generator');
|
|
|
|
const importOptions = {
|
|
returnImportedData: true
|
|
};
|
|
|
|
describe('Importer Legacy', function () {
|
|
beforeEach(testUtils.teardownDb);
|
|
beforeEach(testUtils.setup('roles', 'owner', 'settings'));
|
|
|
|
it('disallows importing Legacy imports', function () {
|
|
const exportData = exportedBodyLegacy().db[0];
|
|
|
|
return dataImporter.doImport(exportData, importOptions)
|
|
.then(function () {
|
|
'0'.should.eql(1, 'Legacy import should fail');
|
|
})
|
|
.catch(function (err) {
|
|
err.message.should.eql('Detected unsupported file structure.');
|
|
});
|
|
});
|
|
});
|