From 31f441ff32ab9f52fc80d0835bdd074554587ef6 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 30 Jun 2017 18:01:51 +0200 Subject: test: Use cheerio for DOM testing --- test/app.test.js | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) (limited to 'test/app.test.js') diff --git a/test/app.test.js b/test/app.test.js index 9b0403c..8507c41 100644 --- a/test/app.test.js +++ b/test/app.test.js @@ -1,28 +1,45 @@ const test = require("ava"); const path = require("path"); const request = require("supertest"); +const cheerio = require("cheerio"); process.chdir(path.resolve(__dirname, "./testsite/")); const config = require(path.resolve(__dirname, "../src/modules/config.js")); const app = require("../src/app.js"); +const parseResponse = res => + cheerio.load(res.text, { + normalizeWhitespace: true, + useHtmlParser2: true + }); + test("homepage", t => { return request(app.listen()) .get("/") .expect(200) - .expect(/