   chai = require 'chai' unless chai
   Resize = require '../components/Resize-node.coffee'
   testutils = require './testutils'
+  sharp = require 'sharp'
 else
   Resize = require 'noflo-sharp/components/Resize.js'
   testutils = require 'noflo-image/spec/testutils.js'

      expected =
        width: 1024
      out.on 'data', (data) ->
        chai.expect(data).to.be.an 'object'
        chai.expect(data.width).to.be.equal expected.width
        chai.expect(data.originalWidth).to.be.equal original.width
        done()

      width.send expected.width
      ins.send __dirname + '/fixtures/foo.jpeg'

      expected =
        width: 256
      out.on 'data', (data) ->
        buffer = sharp data
        buffer.metadata (err, meta) ->
          chai.expect(meta.width).to.be.equal expected.width
          done()

      width.send expected.width
      testutils.getBuffer __dirname + '/fixtures/foo.tif', (buffer) ->
        ins.send buffer

  describe 'when passed a path to TIFF file', ->
    original =
      width: 1076
      height: 750
    it 'should resize it to the specified dimension', (done) ->
      expected =
        width: 256
      out.on 'data', (data) ->
        buffer = sharp data
        buffer.metadata (err, meta) ->
          chai.expect(meta.width).to.be.equal expected.width
          done()

      width.send expected.width
      ins.send __dirname + '/fixtures/foo.tif'
