var assert = require('assert')
  , doc = require('../lib/npm-doc');

// So hacky...git multiple calls to getDocs can't be made concurrently, so I'm
// using arbitrary setTimeouts to try to space things out.
module.exports = {
  'test failure on invalid pkg': function () {
    doc.getDocs('not-a-valid-pkg-asdf', {npm_loglevel: 'silent'},
                function (err, data) {
                  assert.isNotNull(err);
              });
  },

  'test failure on invalid pkg with version': function () {
    setTimeout(function () {
      doc.getDocs({'not-a-valid-pkg-asdf': '0.0.1'}, function (err, data) {
        assert.isNotNull(err);
      })}, 500);
  },

  'test failure on invalid version of valid pkg': function () {
    doc.getDocs('npm', 'a.b.c', function (err, data) {
      assert.isNotNull(err);
    });
  },

  'test failure on no pkg or version': function () {
    doc.getDocs(function (err, data) {
      assert.isNotNull(err);
    });
  },

  'test success on pkgname string': function () {
    setTimeout(function () {
      doc.getDocs('npm', function (err, data) {
        assert.isDefined(data);
      });
    }, 1000);
  },

  'test success on pkgname array': function () {
    setTimeout(function () {
      doc.getDocs(['npm'], function (err, data) {
        assert.isDefined(data);
      });
    }, 1500);
  },

  'test success on pkgname:version object': function () {
    setTimeout(function () {
      doc.getDocs({'dropbox': '0.1.3'}, function (err, data) {
        assert.isDefined(data);
      });
    }, 2000);
  }
}

@@ -66,146 +66,8 @@
 );%0A%0A
-// So hacky...git multiple calls to getDocs can't be made concurrently, so I'm%0A// using arbitrary setTimeouts to try to space things out.%0A
 modu
@@ -171,50 +171,8 @@
 df',
- %7Bnpm_loglevel: 'silent'%7D,%0A               
  fun
@@ -191,28 +191,16 @@
 data) %7B%0A
-            
       as
@@ -220,26 +220,16 @@
 l(err);%0A
-          
     %7D);%0A
@@ -298,39 +298,8 @@
 ) %7B%0A
-    setTimeout(function () %7B%0A  
     
@@ -366,34 +366,32 @@
 , data) %7B%0A      
-  
 assert.isNotNull
@@ -405,20 +405,10 @@
     
-  %7D)%7D, 500);
+%7D)
 %0A  %7D
@@ -761,39 +761,8 @@
 ) %7B%0A
-    setTimeout(function () %7B%0A  
     
@@ -801,34 +801,32 @@
 , data) %7B%0A      
-  
 assert.isDefined
@@ -841,25 +841,9 @@
     
-  %7D);%0A    %7D, 1000
+%7D
 );%0A 
@@ -900,39 +900,8 @@
 ) %7B%0A
-    setTimeout(function () %7B%0A  
     
@@ -942,34 +942,32 @@
 , data) %7B%0A      
-  
 assert.isDefined
@@ -982,25 +982,9 @@
     
-  %7D);%0A    %7D, 1500
+%7D
 );%0A 
@@ -1050,39 +1050,8 @@
 ) %7B%0A
-    setTimeout(function () %7B%0A  
     
@@ -1109,26 +1109,24 @@
 ta) %7B%0A      
-  
 assert.isDef
@@ -1145,25 +1145,9 @@
     
-  %7D);%0A    %7D, 2000
+%7D
 );%0A 

Remove npm load interleaving via setTimeout thanks to npm fix (d61c3b4).