'use strict';
if(process.version.match(/0\.12\.?\d?/)){
  console.log("harmonize");
  require("harmonize");
}
var assert = require('assert');
var Metalsmith = require('metalsmith');
var imagecover = require('../lib/');
var markdown = require('metalsmith-markdown');

describe('metalsmith-imagecover', function() {
  it('should add first image as a cover', function(done) {
    var metalsmith = Metalsmith('test/fixtures/basic');
    metalsmith
      .use(markdown())
      .use(imagecover())
      .build(function(err, files) {
        if (err) {
          return done(err);
        }
        var cover = files["uno.html"].cover;
        assert.equal(cover.src, "/mountain.png");
        assert.equal(cover.title, "Mountain Title");
        assert.equal(cover.alt, "Mountain Alt");
        cover = files["dos.html"].cover;
        assert.strictEqual(cover, undefined);
        done();
      });
  });

  it('should throw error if used without html files', function(done) {
    var metalsmith = Metalsmith('test/fixtures/basic');
    metalsmith
      .use(imagecover())
      .use(markdown())
      .build(function(err) {
        if (err) {
          return done();
        }
        assert.fail();
      });
  });

  it('should use the given property', function(done) {
    var metalsmith = Metalsmith('test/fixtures/basic');
    metalsmith
      .use(markdown())
      .use(imagecover({property: 'theImageCover'}))
      .build(function(err, files) {
        if (err) {
          return done(err);
        }
        var cover = files["uno.html"].theImageCover;
        assert.equal(cover.src, "/mountain.png");
        assert.equal(cover.title, "Mountain Title");
        assert.equal(cover.alt, "Mountain Alt");
        cover = files["dos.html"].theImageCover;
        assert.strictEqual(cover, undefined);
        done();
      });
  });

  it('should use the given attributes', function(done) {
    var metalsmith = Metalsmith('test/fixtures/basic');
    metalsmith
      .use(markdown())
      .use(imagecover({attributes: ['src', 'alt']}))
      .build(function(err, files) {
        if (err) {
          return done(err);
        }
        var cover = files["uno.html"].cover;
        assert.equal(cover.src, "/mountain.png");
        assert.equal(cover.alt, "Mountain Alt");
        cover = files["dos.html"].cover;
        assert.strictEqual(cover, undefined);
        done();
      });
  });
});

@@ -11,104 +11,8 @@
 t';%0A
-if(process.version.match(/0%5C.12%5C.?%5Cd?/))%7B%0A  console.log(%22harmonize%22);%0A  require(%22harmonize%22);%0A%7D%0A
 var 

Update index.js