/**
 * @fileOverview This test specs runs tests on the ,jsdoc-config.json file of repository. It has a set of strict tests
 * on the content of the file as well. Any change to .jsdoc-config.json must be accompanied by valid test case in this
 * spec-sheet.
 */
/* global describe, it */
describe('JSDoc configuration', function () {
    var fs = require('fs'),
        _ = require('lodash'),
        expect = require('expect.js'),

        json,
        content,
        jsdocConfigPath = './.jsdoc-config.json';

    it('should exist', function (done) {
        fs.stat(jsdocConfigPath, done);
    });

    it('should have readable content', function () {
        expect(content = fs.readFileSync(jsdocConfigPath).toString()).to.be.ok();
    });

    it('should have valid JSON content', function () {
        expect(json = JSON.parse(content)).to.be.ok();
    });

    describe('tags', function () {
        it('should allow unkown tags', function () {
            expect(json.tags.allowUnknownTags).to.be.ok();
        });

        it('should have jsdoc and closure dictionaries', function () {
            expect(json.tags.dictionaries).to.eql(['jsdoc', 'closure']);
        });
    });

    describe('source', function () {
        it('should have an include pattern', function () {
            expect(json.source.includePattern).to.be('.+\\.js(doc)?$');
        });

        it('should have an exclude pattern', function () {
            expect(json.source.excludePattern).to.be('(^|\\/|\\\\)_');
        });
    });

    describe('plugins', function () {
        it('should have the markdown plugin', function () {
            expect(_.includes(json.plugins, 'plugins/markdown')).to.be.ok();
        });
    });

    describe('templates', function () {
        it('should not have clever links', function () {
            expect(json.templates.cleverLinks).to.not.be.ok();
        });

        it('should not have monospace links', function () {
            expect(json.templates.monospaceLinks).to.not.be.ok();
        });

        it('should highlight tutorial code', function () {
            expect(json.templates.highlightTutorialCode).to.be.ok();
        });
    });

    describe('opts', function () {
        it('should use the Postman JSDoc theme', function () {
            expect(json.opts.template).to.be('./node_modules/postman-jsdoc-theme');
        });

        it('should use UTF-8 encoding', function () {
            expect(json.opts.encoding).to.be('utf8');
        });

        it('should create documentation in out/docs', function () {
            expect(json.opts.destination).to.be('./out/docs');
        });

        it('should recurse', function () {
            expect(json.opts.recurse).to.be.ok();
        });

        it('should have a valid readme', function () {
            expect(json.opts.readme).to.be('README.md');
        });
    });

    describe('markdown', function () {
        it('should have a gfm parser', function () {
            expect(json.markdown.parser).to.be('gfm');
        });

        it('should have jsdoc and closure dictionaries', function () {
            expect(json.markdown.hardwrap).to.not.be.ok();
        });
    });
});

@@ -258,33 +258,32 @@
  */%0A
-/* global describe, it */
+var fs = require('fs');%0A
 %0Ades
@@ -337,107 +337,8 @@
 var 
-fs = require('fs'),%0A        _ = require('lodash'),%0A        expect = require('expect.js'),%0A%0A        
 json
@@ -618,16 +618,48 @@
 String()
+, 'Should have readable content'
 ).to.be.
@@ -652,34 +652,32 @@
 ntent').to.be.ok
-()
 ;%0A    %7D);%0A%0A    i
@@ -767,16 +767,50 @@
 content)
+, 'Should have valid JSON content'
 ).to.be.
@@ -807,26 +807,24 @@
 t').to.be.ok
-()
 ;%0A    %7D);%0A%0A 
@@ -885,16 +885,17 @@
 llow unk
+n
 own tags
@@ -956,16 +956,45 @@
 nownTags
+, 'Should allow unknown tags'
 ).to.be.
@@ -987,34 +987,32 @@
  tags').to.be.ok
-()
 ;%0A        %7D);%0A%0A 
@@ -1321,18 +1321,21 @@
 ern).to.
-b
 e
+qual
 ('.+%5C%5C.j
@@ -1468,18 +1468,21 @@
 ern).to.
-b
 e
+qual
 ('(%5E%7C%5C%5C/
@@ -1634,19 +1634,8 @@
 ect(
-_.includes(
 json
@@ -1645,16 +1645,61 @@
 ugins, '
+Should use the markdown plugin').to.include('
 plugins/
@@ -1711,20 +1711,8 @@
 own'
-)).to.be.ok(
 );%0A 
@@ -1874,35 +1874,32 @@
 erLinks).to.
-not.be.ok()
+be.false
 ;%0A        %7D)
@@ -2010,35 +2010,32 @@
 ceLinks).to.
-not.be.ok()
+be.false
 ;%0A        %7D)
@@ -2153,34 +2153,32 @@
 alCode).to.be.ok
-()
 ;%0A        %7D);%0A  
@@ -2320,26 +2320,29 @@
 emplate).to.
-b
 e
+qual
 ('./node_mod
@@ -2478,18 +2478,21 @@
 ing).to.
-b
 e
+qual
 ('utf8')
@@ -2619,18 +2619,21 @@
 ion).to.
-b
 e
+qual
 ('./out/
@@ -2738,26 +2738,24 @@
 se).to.be.ok
-()
 ;%0A        %7D)
@@ -2847,23 +2847,55 @@
 s.readme
-).to.be
+, 'Should use a valid readme').to.equal
 ('README
@@ -3053,23 +3053,64 @@
 n.parser
-).to.be
+, 'Should use the gfm markdown parser').to.equal
 ('gfm');
@@ -3244,19 +3244,16 @@
 .to.
-not.be.ok()
+be.false
 ;%0A  

Update JSDoc-config tests to chai