mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-01 22:02:11 +03:00
4265afe580
refs #9178 - we have to take care that we don't end up in circular dependencies - e.g. API requires UrlService and UrlService needs to require the API (for requesting data) - update the references - we would like to get rid of the utils folder, this is/was the most complicated change
44 lines
1.3 KiB
JavaScript
44 lines
1.3 KiB
JavaScript
var should = require('should'),
|
|
sinon = require('sinon'),
|
|
testUtils = require('../utils'),
|
|
_ = require('lodash'),
|
|
|
|
// Stuff we are testing
|
|
exporter = require('../../server/data/export'),
|
|
globalUtils = require('../../server/utils'),
|
|
|
|
sandbox = sinon.sandbox.create();
|
|
|
|
describe('Exporter', function () {
|
|
before(testUtils.teardown);
|
|
afterEach(testUtils.teardown);
|
|
afterEach(function () {
|
|
sandbox.restore();
|
|
});
|
|
beforeEach(testUtils.setup('default', 'settings'));
|
|
|
|
should.exist(exporter);
|
|
|
|
it('exports data', function (done) {
|
|
exporter.doExport().then(function (exportData) {
|
|
var tables = ['posts', 'users', 'roles', 'roles_users', 'permissions', 'permissions_roles',
|
|
'permissions_users', 'settings', 'tags', 'posts_tags'];
|
|
|
|
should.exist(exportData);
|
|
|
|
should.exist(exportData.meta);
|
|
should.exist(exportData.data);
|
|
|
|
exportData.meta.version.should.equal(globalUtils.ghostVersion.full);
|
|
|
|
_.each(tables, function (name) {
|
|
should.exist(exportData.data[name]);
|
|
});
|
|
|
|
// should not export sqlite data
|
|
should.not.exist(exportData.data.sqlite_sequence);
|
|
done();
|
|
}).catch(done);
|
|
});
|
|
});
|