mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-24 19:33:02 +03:00
0fbf5e12b8
no issue - use latest casper in test fixtures - never ever use the root content folder for tests - if we start/fork Ghost for the tests, we use a tmp folder - this change is required to for an upcoming PR (#9029) - i've added a TODO to create a helper fn for stopping the ghost server, so we can cleanup the tmp folder * Care about TODO's in our channels spec - add the 1.4 compatible casper theme to fixtures - so as soon as you start Ghost, the test env will provide the content folder in /tmp something with the activated latest default casper and the 1.4 compatible old casper - there are tests which tests different logici e.g. pagination - therefor we need a different theme, we are simply using our 1.4 casper
50 lines
1.6 KiB
JavaScript
50 lines
1.6 KiB
JavaScript
var should = require('should'), // jshint ignore:line
|
|
path = require('path'),
|
|
fs = require('fs-extra'),
|
|
extract = require('extract-zip-fork'),
|
|
utils = require('../../../server/utils');
|
|
|
|
describe('Utils: zip-folder', function () {
|
|
const symlinkPath = path.join(__dirname, '..', '..', 'utils', 'fixtures', 'themes', 'theme-symlink'),
|
|
folderToSymlink = path.join(__dirname, '..', '..', 'utils', 'fixtures', 'themes', 'casper'),
|
|
zipDestination = path.join(__dirname, '..', '..', 'utils', 'fixtures', 'themes', 'theme-symlink.zip'),
|
|
unzipDestination = path.join(__dirname, '..', '..', 'utils', 'fixtures', 'themes', 'theme-symlink-unzipped');
|
|
|
|
before(function () {
|
|
fs.removeSync(symlinkPath);
|
|
fs.removeSync(zipDestination);
|
|
fs.removeSync(unzipDestination);
|
|
});
|
|
|
|
after(function () {
|
|
fs.removeSync(symlinkPath);
|
|
fs.removeSync(zipDestination);
|
|
fs.removeSync(unzipDestination);
|
|
});
|
|
|
|
it('ensure symlinks work', function (done) {
|
|
fs.symlink(folderToSymlink, symlinkPath);
|
|
|
|
utils.zipFolder(symlinkPath, zipDestination, function (err) {
|
|
if (err) {
|
|
return done(err);
|
|
}
|
|
|
|
extract(zipDestination, {dir: unzipDestination}, function (err) {
|
|
if (err) {
|
|
return done(err);
|
|
}
|
|
|
|
fs.readdir(unzipDestination, function (err, files) {
|
|
if (err) {
|
|
return done(err);
|
|
}
|
|
|
|
files.length.should.eql(12);
|
|
done();
|
|
});
|
|
});
|
|
});
|
|
});
|
|
});
|