const request = require('supertest') , config = require('./config') , should = require('should') , cheerio = require('cheerio'); const baseURL = config.baseURL; describe('Exercise 3. Directory Explorer ', function(){ describe("When exploring root directory, we:", function(done){ const files = [ '0.txt', 'UppeRCaSeLowerCASE.txt', 'afox.gif', 'asq.png', 'bunny.mp4', 'bunny.ogv', 'ex-node.pdf', 'foo.js', 'freq.html', 'freq.txt', 'four-seasons.mp3', 'hello world node.txt', 'hello.txt', 'identitycrisis', 'images.json', 'index.html', 'myfiles.zip', 'simple.txt', 'style.css', 'thing.jpg', 'turing.txt' ]; const dirs= [ 'level-1', 'icons' ]; let $, linksArr, links, dirFound; before(function(done){ request(baseURL) .get('/explore/') .expect(200) .expect('Content-Type', /text\/html/) .end(function(err, res){ if(err) return done(err); $ = cheerio.load(res.text); linksArr = []; $('a[href]').each(function(index, el){ var href = $(el).attr('href').toString(); linksArr.push(href); }); links = linksArr.join(' '); done(); }); }); it('should have proper links for files', function(){ for (let i=0, l = files.length ; i