/* global afterEach, beforeEach, describe, it */

import assert from 'assert'
import fs from 'fs'
import rimraf from 'rimraf'
import build from '../../src/build'
import hooks from '../../src/hooks'

describe('build', () => {
  const output = './test/integration/output'

  beforeEach(done => {
    fs.mkdirSync(output)
    build(output)

    done()
  })

  afterEach(done => {
    rimraf(output, err => {
      if (err) throw new Error(err)

      done()
    })
  })

  it('successfully creates the hook scripts', done => {
    const files = fs.readdirSync(output)

    assert.strictEqual(hooks.length, files.length)

    done()
  })
})

@@ -611,16 +611,322 @@
 ength)%0A%0A
+    files.forEach(hook =%3E %7B%0A      fs.readFile(hook, (err, data) =%3E %7B%0A        if (err) throw new Error(err)%0A%0A        assert(data.match('#!/usr/bin/env node'))%0A        assert(data.match(%22var Runner = require('hook-script-runner')%22))%0A        assert(data.match(%22new Runner('$%7Bhook%7D').run()%22))%0A      %7D)%0A    %7D)%0A%0A
     done

Add additional coverage for hook script contents