const { expect } = require('chai');
const cheerio = require('cheerio');
const request = require('supertest');
const app = require('../app');


describe('Pages', function() {
  let req;

  describe('/', function() {
    beforeEach(function() {
      req = request(app).get('/')
    });

    it('returns 200 OK', function(done) {
      req.expect(200, done);
    });

    it('renders template', function (done) {
      req.expect('Content-Type', /text\/html/, done);
    });

    it('has valid title', function (done) {
      req
        .expect((res) => {
          const content = res.text;
          const $ = cheerio.load(content);
          expect($('title').text()).to.eq('Slava Pavlutin');
        })
        .end(done);
    });
  });

  describe('/contact', function() {
    beforeEach(function() {
      req = request(app).get('/contact');
    });

    it('returns 200 OK', function (done) {
      req.expect(200, done);
    });

    it('renders template', function (done) {
      req.expect('Content-Type', /text\/html/, done);
    });

    it('has valid title', function (done) {
      req
        .expect((res) => {
          const content = res.text;
          const $ = cheerio.load(content);
          expect($('title').text()).to.eq('Slava Pavlutin | Contact');
        })
        .end(done);
    });
  });
});

const { expect } = require('chai');
const cheerio = require('cheerio');
const request = require('supertest');
const app = require('../app');


describe('Pages', function() {
  let req;

  describe('/', function() {
    beforeEach(function() {
      req = request(app).get('/');
    });

    it('returns 200 OK', function(done) {
      req.expect(200, done);
    });

    it('renders template', function (done) {
      req.expect('Content-Type', /text\/html/, done);
    });

    it('has valid title', function (done) {
      req
        .expect((res) => {
          const content = res.text;
          const $ = cheerio.load(content);
          expect($('title').text()).to.eq('Slava Pavlutin');
        })
        .end(done);
    });
  });

  describe('/contact', function() {
    beforeEach(function() {
      req = request(app).get('/contact');
    });

    it('returns 200 OK', function (done) {
      req.expect(200, done);
    });

    it('renders template', function (done) {
      req.expect('Content-Type', /text\/html/, done);
    });

    it('has valid title', function (done) {
      req
        .expect((res) => {
          const content = res.text;
          const $ = cheerio.load(content);
          expect($('title').text()).to.eq('Slava Pavlutin | Contact');
        })
        .end(done);
    });
  });
});

Add semicolon in test file