Skip to content
This repository has been archived by the owner on Mar 18, 2018. It is now read-only.

Commit

Permalink
fixes rimraf tests, adds tests for no repository url case
Browse files Browse the repository at this point in the history
  • Loading branch information
wujashek committed Nov 13, 2017
1 parent 659f798 commit b5efa4c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/unit/tasks/deploy/fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ describe('deploy:fetch task', function () {
fetchFactory(shipit);

fetchFactory.__set__('mkdirp', mkdirpMock);
fetchFactory.__set__('rimraf', rimrafMock);

// Shipit config
shipit.initConfig({
Expand All @@ -35,6 +36,7 @@ describe('deploy:fetch task', function () {

afterEach(function () {
mkdirpMock.reset();
rimrafMock.reset();
shipit.local.restore();
});

Expand Down Expand Up @@ -74,6 +76,16 @@ describe('deploy:fetch task', function () {
done();
});
});

it('should do nothing when reposity url is empty', function (done) {
delete shipit.config.repositoryUrl;

shipit.start('deploy:fetch', function (err) {
if (err) return done(err);
expect(mkdirpMock).callCount(0);
done();
});
});

it('should create workspace, create repo, checkout and call sync, update submodules', function (done) {
shipit.config.updateSubmodules = true;
Expand Down
11 changes: 11 additions & 0 deletions test/unit/tasks/deploy/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ var createShipitInstance = function (conf) {
shipit.initConfig({
test: _.merge({
workspace: '/tmp/workspace',
repositoryUrl: 'git://website.com/user/repo',
deployTo: '/remote/deploy'
}, conf)
});
Expand Down Expand Up @@ -253,6 +254,16 @@ describe('deploy:update task', function () {
});
});
});

it('should not set revision if no repository url is present', function (done) {
delete shipit.config.repositoryUrl;

shipit.start('deploy:update', function (err) {
if (err) return done(err);
expect(shipit.currentRevision).to.equal(undefined);
done();
});
});

it('should copy contents of previous release into new folder', function (done) {
shipit.start('deploy:update', function (err) {
Expand Down

0 comments on commit b5efa4c

Please sign in to comment.