// jshint node: true
var expect = require('chai').expect;
var GitTaggingAdapter = require('../../../lib/git-tag');

describe('git-tag', function() {
  describe('#createTag', function() {
    it('concatenates manifest and version', function(){
      var subject = new GitTaggingAdapter({
        manifest: 'manifest',
        version: 'version'
      });

      expect(subject.createTag()).to.equal('manifest:version');
    });

    it('determines version using git-repo-version', function(){
      var version = require('git-repo-version');
      var subject = new GitTaggingAdapter({
        manifest: 'manifest',
        version: version
      });

      expect(subject.createTag()).to.equal('manifest:' + version);
    });

    it('creates tag with a useful format', function(){
      var subject = new GitTaggingAdapter({
        manifest: 'manifest',
      });

      // Format: manifest, version in form 1.2.3, "+", 8 chars of git hash
      var format = /^manifest:\d+\.\d+\.\d+\+[0-9a-f]{8}$/;
      expect(subject.createTag()).to.match(format);
    });
  });
});

@@ -226,34 +226,35 @@
 ion', function()
+ 
 %7B%0A
-
       var subjec
@@ -476,32 +476,33 @@
 ion', function()
+ 
 %7B%0A      var vers
@@ -775,16 +775,17 @@
 nction()
+ 
 %7B%0A      
@@ -998,16 +998,16 @@
 %5D%7B8%7D$/;%0A
-
       ex
@@ -1057,16 +1057,477 @@
 %0A    %7D);
+%0A%0A    it('throws an error if the version is blank', function()%7B%0A      var subject = new GitTaggingAdapter(%7B%0A        manifest: 'manifest',%0A        version: ''%0A      %7D);%0A%0A      expect(subject.createTag).to.throw(Error);%0A    %7D);%0A%0A    it('throws an error if the version is undefined', function()%7B%0A      var subject = new GitTaggingAdapter(%7B%0A        manifest: 'manifest',%0A        version: undefined%0A      %7D);%0A%0A      expect(subject.createTag).to.throw(Error);%0A    %7D);
 %0A  %7D);%0A%7D

Add test coverage for error handling