Skip to content
This repository has been archived by the owner on Nov 4, 2022. It is now read-only.

Commit

Permalink
Making the version test unitary.
Browse files Browse the repository at this point in the history
  • Loading branch information
henvic committed Apr 6, 2015
1 parent 86ac823 commit 69ab08d
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions test/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,33 @@ describe('Version Module Tests', function() {
});

it('should print versions', function() {
var loggerMock = {
var pkgMock,
baseMock,
loggerMock;

pkgMock = {
name: 'gh',
version: '0.0.1'
};

baseMock = {
asyncReadPackages: function(callback) {
callback(pkgMock);
}
};

loggerMock = {
log: function(message) {
var parts = message.split(' ');

assert.strictEqual(parts.length, 2);
assert.strictEqual(parts[0].slice(0, 2), 'gh');
assert.strictEqual(parts[0], 'gh');
assert.strictEqual(parts[1], pkgMock.version);
assert(semver.valid(parts[1]) !== null);
}
};

version.__set__("base", baseMock);
version.__set__("logger", loggerMock);

new version.Impl().run();
Expand Down

0 comments on commit 69ab08d

Please sign in to comment.