mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-13 22:41:32 -05:00
2b9be5376e
Hacky implementation of a suite of casper tests. This is here so that we can start to build up some tests. Main thing missing is being able to simulate keypresses for CodeMirror Making the tests run nicely with grunt, travis and be independent rather than interdependent can all come later. - See tests/functional/base.js for full usage instructions & implementation notes
58 lines
No EOL
1.6 KiB
JavaScript
58 lines
No EOL
1.6 KiB
JavaScript
/*globals describe, beforeEach, it*/
|
|
var _ = require("underscore"),
|
|
should = require('should'),
|
|
when = require('when'),
|
|
sinon = require('sinon'),
|
|
helpers = require('./helpers'),
|
|
exporter = require('../../server/data/export'),
|
|
Exporter001 = require('../../server/data/export/001'),
|
|
errors = require('../../server/errorHandling');
|
|
|
|
describe("Export", function () {
|
|
|
|
should.exist(exporter);
|
|
|
|
beforeEach(function (done) {
|
|
helpers.resetData().then(function () {
|
|
done();
|
|
}, done);
|
|
});
|
|
|
|
it("resolves 001", function (done) {
|
|
var exportStub = sinon.stub(Exporter001, "exportData", function () {
|
|
return when.resolve();
|
|
});
|
|
|
|
exporter("001").then(function () {
|
|
exportStub.called.should.equal(true);
|
|
|
|
exportStub.restore();
|
|
|
|
done();
|
|
}).then(null, done);
|
|
});
|
|
|
|
describe("001", function () {
|
|
|
|
should.exist(Exporter001);
|
|
|
|
it("exports data", function (done) {
|
|
exporter("001").then(function (exportData) {
|
|
var tables = ['posts', 'users', 'roles', 'roles_users', 'permissions', 'permissions_roles', 'settings'];
|
|
|
|
should.exist(exportData);
|
|
|
|
should.exist(exportData.meta);
|
|
should.exist(exportData.data);
|
|
|
|
exportData.meta.version.should.equal("001");
|
|
|
|
_.each(tables, function (name) {
|
|
should.exist(exportData.data[name]);
|
|
});
|
|
|
|
done();
|
|
}).then(null, done);
|
|
});
|
|
});
|
|
}); |