var assert = require('assert');
var ghlint = require('../index');

describe('ghlint', function () {
  describe('.linters', function () {
    it('has multiple linters', function () {
      assert(ghlint.linters.length);
    });

    it('has linters with a String message', function () {
      ghlint.linters.every(function (linter) {
        return linter.message && typeof linter.message === 'string';
      });
    });

    it('has linters with a lint function', function () {
      ghlint.linters.every(function (linter) {
        return linter.message && typeof linter.message === 'function';
      });
    });
  });

  describe('.lintRepo()', function () {
    context('with a real repo', function () {
      it('passes valid Results', function (done) {
        ghlint.lintRepo('nicolasmccurdy', 'ghlint', function (error, results) {
          assert.ifError(error);
          assert(results.length);
          assert(results.every(function (result) {
            return result.message &&
                   typeof result.message === 'string' &&
                   typeof result.result === 'boolean';
          }));
          done();
        });
      });
    });

    context('with a fake repo', function () {
      it('passes a "Not Found" error', function (done) {
        ghlint.lintRepo('nicolasmccurdy', 'qwertyuiop', function (error) {
          assert(error && error.message === 'Not Found');
          done();
        });
      });
    });

    context('with a fake owner', function () {
      it('passes a "Not Found" error', function (done) {
        ghlint.lintRepo('login', 'repo', function (error) {
          assert(error && error.message === 'Not Found');
          done();
        });
      });
    });
  });

  describe('.lintReposByOwner()', function () {
    context('with a real owner', function () {
      it('passes valid RepoResults', function (done) {
        this.timeout(10000);

        ghlint.lintReposByOwner('nicolasmccurdy', function (error, repoResults) {
          assert.ifError(error);
          assert(repoResults.length);
          assert(repoResults.every(function (result) {
            return typeof result.owner === 'string' &&
                   typeof result.name === 'string' &&
                   typeof result.results === 'object' &&
                   result.results.length;
          }));
          done();
        });
      });
    });

    context('with a fake user', function () {
      it('passes a "Not Found" error', function (done) {
        ghlint.lintReposByOwner('login', function (error) {
          assert(error && error.message === 'Not Found');
          done();
        });
      });
    });
  });
});

@@ -205,27 +205,31 @@
 nters.length
+ %3E 1
 );%0A
-
     %7D);%0A%0A   
@@ -281,32 +281,39 @@
 tion () %7B%0A      
+assert(
 ghlint.linters.e
@@ -406,32 +406,33 @@
 tring';%0A      %7D)
+)
 ;%0A    %7D);%0A%0A    i
@@ -485,24 +485,31 @@
  () %7B%0A      
+assert(
 ghlint.linte
@@ -551,39 +551,36 @@
   return linter.
-message
+lint
  && typeof linte
@@ -577,31 +577,28 @@
 peof linter.
-message
+lint
  === 'functi
@@ -602,32 +602,33 @@
 ction';%0A      %7D)
+)
 ;%0A    %7D);%0A  %7D);%0A
@@ -901,32 +901,36 @@
 t(results.length
+ %3E 1
 );%0A          ass
@@ -1372,36 +1372,58 @@
     assert(error
- && 
+);%0A          assert.equal(
 error.message ==
@@ -1411,36 +1411,33 @@
 al(error.message
- ===
+,
  'Not Found');%0A 
@@ -1662,36 +1662,58 @@
     assert(error
- && 
+);%0A          assert.equal(
 error.message ==
@@ -1701,36 +1701,33 @@
 al(error.message
- ===
+,
  'Not Found');%0A 
@@ -2110,16 +2110,20 @@
 s.length
+ %3E 1
 );%0A     
@@ -2629,20 +2629,42 @@
 rt(error
- && 
+);%0A          assert.equal(
 error.me
@@ -2668,20 +2668,17 @@
 .message
- ===
+,
  'Not Fo

Improve test assertions