/**
 * is-missing <https://github.com/tunnckoCore/is-missing>
 *
 * Copyright (c) 2015 Charlike Mike Reagent, contributors.
 * Released under the MIT license.
 */

'use strict';

var test = require('testit');
var assert = require('assert');
var isMissing = require('./index');

test('is-missing:', function() {
  test('should throw TypeError when `name` is not a string', function(done) {
    assert.throws(function _fixture() {
      isMissing([1, 2, 3]);
    }, TypeError);
    assert.throws(function _fixture() {
      isMissing([1, 2, 3]);
    }, /to be string, but array given/);
    done();
  });

  test('should throw TypeError when `callback` is not a function', function(done) {
    assert.throws(function _fixture() {
      isMissing('foobar', 'callback');
    }, TypeError);
    assert.throws(function _fixture() {
      isMissing('foobar', 'callback');
    }, /to be function, but string given/);
    done();
  });

  test('should return false if given `name` exist in npm registry', function(done) {
    isMissing('assert-kindof', function _cb(err, res) {
      assert.strictEqual(err, null);
      assert.strictEqual(res, false);
      done();
    });
  });

  test('should return true if given `name` not exist in npm registry', function(done) {
    isMissing('wombat-foo-bar-baz-qux-zero-four', function _cb(err, res) {
      assert.strictEqual(err, null);
      assert.strictEqual(res, true);
      done();
    });
  });

  test('should return false when repository already exists', function(done) {
    isMissing('tunnckoCore/assert-kindof', function _cb(err, res) {
      assert.strictEqual(err, null);
      assert.strictEqual(res, false);
      done();
    });
  });

  test('should return true when repository not exists', function(done) {
    isMissing('tunnckoCore/foo-bar-baz-qux', function _cb(err, res) {
      assert.strictEqual(err, null);
      assert.strictEqual(res, true);
      done();
    });
  });
});

@@ -382,38 +382,24 @@
 done) %7B%0A    
-assert.throws(
 function _fi
@@ -387,33 +387,32 @@
  %7B%0A    function 
-_
 fixture() %7B%0A    
@@ -432,32 +432,59 @@
 1, 2, 3%5D);%0A    %7D
+%0A%0A    assert.throws(fixture
 , TypeError);%0A  
@@ -504,62 +504,14 @@
 ws(f
-unction _fixture() %7B%0A      isMissing(%5B1, 2, 3%5D);%0A    %7D
+ixture
 , /t
@@ -645,38 +645,24 @@
 done) %7B%0A    
-assert.throws(
 function _fi
@@ -650,33 +650,32 @@
  %7B%0A    function 
-_
 fixture() %7B%0A    
@@ -714,16 +714,43 @@
 );%0A    %7D
+%0A%0A    assert.throws(fixture
 , TypeEr
@@ -778,73 +778,14 @@
 ws(f
-unction _fixture() %7B%0A      isMissing('foobar', 'callback');%0A    %7D
+ixture
 , /t
@@ -1691,35 +1691,49 @@
 ng('
-tunnckoCore/foo-bar-baz-qux
+mochajs/kjerhkjghkjhhhhhhhhhhhh5kjdsvfsdf
 ', f

update tests, DRY code