0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00
ghost/test/regression/exporter/exporter_spec.js
Hannah Wolfe 7f1d3ebc07
Move tests from core to root (#11700)
- move all test files from core/test to test/
- updated all imports and other references
- all code inside of core/ is then application code
- tests are correctly at the root level
- consistent with other repos/projects

Co-authored-by: Kevin Ansfield <kevin@lookingsideways.co.uk>
2020-03-30 16:26:47 +01:00

43 lines
1.3 KiB
JavaScript

var should = require('should'),
sinon = require('sinon'),
testUtils = require('../../utils'),
_ = require('lodash'),
// Stuff we are testing
exporter = require('../../../core/server/data/exporter'),
ghostVersion = require('../../../core/server/lib/ghost-version');
describe('Exporter', function () {
before(testUtils.teardownDb);
afterEach(testUtils.teardownDb);
afterEach(function () {
sinon.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(ghostVersion.full);
_.each(tables, function (name) {
should.exist(exportData.data[name]);
});
should.not.exist(_.find(exportData.data.settings, {key: 'permalinks'}));
// should not export sqlite data
should.not.exist(exportData.data.sqlite_sequence);
done();
}).catch(done);
});
});