From 803b25c15cc8a5743382deaff57481ecca6a0f3b Mon Sep 17 00:00:00 2001 From: Robert Haritonov Date: Thu, 28 May 2015 02:50:29 +0200 Subject: [PATCH] remove clarify tests --- test/specs/middleware/clarify.js | 274 ------------------------------- 1 file changed, 274 deletions(-) delete mode 100644 test/specs/middleware/clarify.js diff --git a/test/specs/middleware/clarify.js b/test/specs/middleware/clarify.js deleted file mode 100644 index 6e60733..0000000 --- a/test/specs/middleware/clarify.js +++ /dev/null @@ -1,274 +0,0 @@ -var fs = require('fs'); -var path = require('path'); - -var pathToMasterApp = path.resolve('./'); -var jq = fs.readFileSync(path.join(pathToMasterApp,'assets/js/lib/jquery-1.11.1.js'), "utf-8"); - -var should = require('should'); -var assert = require('assert'); -var request = require('supertest'); -var jsdom = require('jsdom'); - -var loadOptions = require(path.join(pathToMasterApp, 'core/loadOptions')); -global.opts = loadOptions(path.resolve(pathToMasterApp)); - - -describe('Clarify test /docs/spec?clarify=true', function () { - describe('GET from JSDOM /docs/spec?clarify=true...', function () { - var url = 'http://localhost:8080/docs/spec/?clarify=true'; - it('should return nothing (§ions=77)', function (done) { - request(url) - .get('§ions=77') - .expect(200) - .end(function (err, res) { - if (err) { - throw err; - } - - jsdom.env({ - html: res.text, - src: [jq], - done: function (errors, window) { - var $ = window.$; - var examples = $('.source_example'); - - examples.length.should.equal(0); - - done(); - } - }); - }); - }); - - it('should return all sections', function (done) { - request(url) - .get() - .expect(200) - .end(function (err, res) { - if (err) { - throw err; - } - - jsdom.env({ - html: res.text, - src: [jq], - done: function (errors, window) { - var $ = window.$; - var sectionHeaders = $('.source_section_h'); - var examples = $('.source_example'); - - sectionHeaders.length.should.be.greaterThan(1); - examples.length.should.be.greaterThan(0); - - done(); - } - }); - }); - }); - - it('should return one example', function (done) { - request(url) - .get('§ions=1.1') - .expect(200) - .end(function (err, res) { - if (err) { - throw err; - } - - jsdom.env({ - html: res.text, - src: [jq], - done: function (errors, window) { - var $ = window.$; - var examples = $('.source_example'); - - examples.length.should.equal(1); - - done(); - } - }); - }); - }); - - it('should have injected resources', function (done) { - request(url) - .get('§ions=1.1') - .expect(200) - .end(function (err, res) { - if (err) { - throw err; - } - - jsdom.env({ - html: res.text, - src: [jq], - done: function (errors, window) { - var $ = window.$; - - $('[href*="bootstrap.css"]').length.should.equal(1); - $('body > style').length.should.be.greaterThan(0); - $('body > script').length.should.be.greaterThan(0); - - done(); - } - }); - }); - }); - - it('should change template', function (done) { - request(url) - .get('&tpl=clear') - .expect(200) - .end(function (err, res) { - if (err) { - throw err; - } - - jsdom.env({ - html: res.text, - src: [jq], - done: function (errors, window) { - var $ = window.$; - var examples = $('.source_example'); - - $('.__clear').length.should.equal(1); - examples.length.should.equal(0); - - done(); - } - }); - }); - }); - }); - - describe('GET from API /docs/spec?clarify=true&fromApi=true...', function () { - var urlFromApi = 'http://localhost:8080/docs/spec/?clarify=true&fromApi=true'; - - it('should return nothing (§ions=77&apiUpdate=true)', function (done) { - this.timeout(10000); - request(urlFromApi) - .get('§ions=77&apiUpdate=true') - .expect(500) - .end(function (err, res) { - if (err) { - throw err; - } - - jsdom.env({ - html: res.text, - src: [jq], - done: function (errors, window) { - var $ = window.$; - var examples = $('.source_example'); - - examples.length.should.equal(0); - - done(); - } - }); - }); - }); - - if (global.opts.plugins && global.opts.plugins.htmlParser && global.opts.plugins.htmlParser.enabled) { - it('should return all sections', function (done) { - request(urlFromApi) - .get() - .expect(200) - .end(function (err, res) { - if (err) { - throw err; - } - - jsdom.env({ - html: res.text, - src: [jq], - done: function (errors, window) { - var $ = window.$; - var sectionHeaders = $('.source_section_h'); - var examples = $('.source_example'); - - sectionHeaders.length.should.be.greaterThan(1); - examples.length.should.be.greaterThan(0); - - done(); - } - }); - }); - }); - - it('should return one example', function (done) { - request(urlFromApi) - .get('§ions=1.1') - .expect(200) - .end(function (err, res) { - if (err) { - throw err; - } - - jsdom.env({ - html: res.text, - src: [jq], - done: function (errors, window) { - var $ = window.$; - var examples = $('.source_example'); - - examples.length.should.equal(1); - - done(); - } - }); - }); - }); - - it('should have injected resources', function (done) { - request(urlFromApi) - .get('§ions=1.1') - .expect(200) - .end(function (err, res) { - if (err) { - throw err; - } - - jsdom.env({ - html: res.text, - src: [jq], - done: function (errors, window) { - var $ = window.$; - - $('[href*="bootstrap.css"]').length.should.equal(1); - $('body > style').length.should.be.greaterThan(0); - $('body > script').length.should.be.greaterThan(0); - - done(); - } - }); - }); - }); - - it('should change template', function (done) { - request(urlFromApi) - .get('&tpl=clear') - .expect(200) - .end(function (err, res) { - if (err) { - throw err; - } - - jsdom.env({ - html: res.text, - src: [jq], - done: function (errors, window) { - var $ = window.$; - var examples = $('.source_example'); - - $('.__clear').length.should.equal(1); - examples.length.should.equal(0); - - done(); - } - }); - }); - }); - } - }); -}); \ No newline at end of file